I have below mapping in .vimrc.
nmap gb <C-^>
What I want to do is open a directory, gf to a file, then gb go back to previous directory.
But sometime gb is not working properly. It goes back to another text file instead of previous directory.
Vi and Vim Stack Exchange is a question and answer site for people using the vi and Vim families of text editors. It only takes a minute to sign up.
Sign up to join this communityI have below mapping in .vimrc.
nmap gb <C-^>
What I want to do is open a directory, gf to a file, then gb go back to previous directory.
But sometime gb is not working properly. It goes back to another text file instead of previous directory.
The problem is netrw, the plugin which allows vim to browse directories, overrides the gb
map for its bookmarks feature.
You can disable this by providing a junk mapping in your vimrc:
nmap <sid>NetrwBookHistHandler_gb <Plug>NetrwBookHistHandler_gb
Or use any left hand side
nmap <silent> <f4> <Plug>NetrwBookHistHandler_gb
Also, you don't need to use gf to go to a file inside a directory. Pressing enter works too.