How to unmap TAB and do not make Ctrl-I invalid in VIM

后端 未结 3 1569
终归单人心
终归单人心 2020-12-08 21:10

When I use vim in normal mode, I often press the TAB key accidentally, the key TAB do the same thing as Ctrl-I in default. I want to make the key TAB do nothing, so I put th

相关标签:
3条回答
  • 2020-12-08 21:29

    I would advice to having <TAB> do something useful:

    nmap <TAB> <C-W>
    nmap <TAB><TAB> <C-W><C-W>
    

    this way you can use tab for the window operations. Of course with this you cannot have the ctrl-i behavior. I map ,i for this:

    nnoremap ,i <C-I>
    
    0 讨论(0)
  • 2020-12-08 21:40

    Due to the way that the keyboard input is handled internally, this unfortunately isn't generally possible today, even in GVIM. Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Unless your terminal sends a distinct termcap code for it, which most don't.) This also applies to <Tab> / <C-I>, <CR> / <C-M> etc. This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

    Some people (foremost Paul LeoNerd Evans) want to fix that (even for console Vim in terminals that support this), and have floated various proposals.

    But as of today, no patches or volunteers have yet come forward, though many have expressed a desire to have this in a future Vim 8 major release.

    0 讨论(0)
  • 2020-12-08 21:47

    I found that ctrl-tab work as default ctrl-i when tab is remaped.

    Works in macvim. I did not check in others vims.

    0 讨论(0)
提交回复
热议问题