How do you return from 'gf' in Vim
I am making use of Vim for home windows mounted in Unix setting. Many thanks to this website I currently make use of the
gf command to head to a documents under the arrow.
I'm seeking a command to either:
- go back to the previous documents (comparable to Ctrl+T for ctags), or
gfto instantly release the new documents in a new window
I have not considered your gf command yet I visualize it makes use of the : e or : locate command.¢ Assuming that this is proper, merely change the : e or : locate with : new (or : vnew for an upright split) and also the documents will certainly open in a new window as opposed to the very same one.
"Switch between header and cpp nmap ,s :find %:t:r.cpp<CR> nmap ,S :new %:t:r.cpp<CR> nmap ,h :find %:t:r.h<CR> nmap ,H :new %:t:r.h<CR> nmap ,F :new =expand("<cfile>:t")<CR><CR> nmap ,d :new =expand("<cfile>")<CR><CR>
When you open a new file (with gf or :n or another command) the old file remains in a buffer list. You can list open files with :ls
If you want to navigate easily between buffers in vim, you can create a mapping like this:
nmap <M-LEFT> :bN<cr> nmap <M-RIGHT> :bn<cr>
Now you can switch between buffers with Alt+← or Alt+→.
The complete documentation on mappings is here:
I do not recognize the response to component 2 of your inquiry, yet I can aid with component 1. Usage.
Vim keeps a checklist of files (barriers) that it is editing and enhancing. If you type
it will certainly detail all the files you are presently editing and enhancing. The documents because checklist with a % close to it is the existing documents. The one with the # close to it is the alternative file.: e # will certainly switch over in between the existing and also alternative documents. As opposed to type that a lot, I map F2 to: e # so I can conveniently turn in between the existing and also alternative files. I map the command to F2 by including this to.vimrc
nmap `<F2> :e#<CR>`