I am trying to write vim function which should make window to go to previous open buffer. How can I do it from command line? My first suggest was to find out some CTRL-O command line alternative.
The jumplist is not the best way to do buffer navigation. Vim has a great number of buffer navigation tools which are probably better used for this task.
<c-6>- jump to the alternative file or if providing a count to a certain buffer number. See
:b- jump to a specific buffer. Takes buffer number or partial filename. See
:sb- split variant of
:buffers- list opened buffers. See
#used to represent the alternative file which is often the previous buffer. e.g.
- Common mapping
nnoremap <leader>b :ls<cr>:b<space>
I found the solution in use of
normal command. There would be such a line in my function:
exe "normal \<C-O>"