When browsing a local directory using Vim and the built-in netrw file browsing support, I would like to open a file to view it and then return to the same location in the file listing where I was before opening the file.
The way I usually browse files is to open a file by pressing Enter
in netrw, and then when I am done looking at the file, and I want to return to the file listing, I press Ctrl+o
to go back to the netrw view, but the cursor always goes back to the top of the file listing, which is very inconvenient when I am browsing a typical directory. I would like to go back to the same location in the file listing where I was when I pressed Enter to open the file.
I know that I can open the file in a split window by pressing o
in the netrw file listing view, instead of Enter to open it in the same window, but I don't want to split the view: I want to use the whole view for the file until I am done looking at it, and then I want to go back to the same place in the file list to potentially open the next file in the list.