search

Home  >  Q&A  >  body text

vim - Mapping <tab> in visual mode to implement cursor switching between split windows?

This requirement was inspired by vifm. In my current use, I mostly use two split-windows.

phpcn_u1582phpcn_u15822773 days ago971

reply all(1)I'll reply

  • 迷茫

    迷茫2017-05-16 16:42:38

    I’m wondering, why does it have to be in Visual Mode? Is there any particular reason?

    If it is Normal Mode, it is easier to understand, and the mapping method is not difficult:

    nnoremap <TAB> <C-w>w
    

    This way you can switch between any number of separate windows. Then the same is true for Visual Mode:

    vnoremap <TAB> <C-w>w
    

    But there is an undecided point here, that is, should I keep the Visual Mode selection part in another window after switching? If so, maybe you should add gv:

    vnoremap <TAB> <C-w>wgv
    

    reply
    0
  • Cancelreply