Search code examples
vimmacvim

Jump with Ctrl-I doesn't work in my MacVim, but Ctrl-O works?


Jump with CtrlI doesn't work in my Vim, but CtrlO works.

It's weird, verbose map <c-i> or verbose map <c-I> shows below:

s  <Tab>         <Plug>snipMateNextOrTrigger
    Last set from ~/.vim/bundle/vim-snipmate/after/plugin/snipMate.vim
x  <Tab>         >gv
    Last set from ~/.vim/plugin/settings/Settings.vim
n  <Tab>         v>
    Last set from ~/.vim/plugin/settings/Settings.vim

When I press CtrlI, the current line will be indented, and vim goes to Visual Mode.

I tried to add unmap <c-i> to ~/.gvimrc, but it failed, when macvim starts

Error detected while processing /Users/dfang/.vimrc:
line   83:
E31: No such mapping

How can I get back my CtrlI, and how can I remap CtrlO to Ctrl- (left from = key) ?


Solution

    1. <C-i> and <Tab> are strictly equivalent.

    2. You are actively overriding <Tab> and therefore <C-i> in ~/.vim/plugin/settings/Settings.vim.

    3. If you want <C-i> to work normally don't override it (or <Tab>). Simple.

    4. Unless you have a very specific reason to do so, you don't need to put anything in ~/.gvimrc.

    5. The normal place for your settings/mappings is ~/.vimrc, there's no valid reason to put them anywhere else (~/.vim/plugin/settings/Settings.vim or wherever).

    6. Use nnoremap <C-+> <C-o> if you want <C-+> to do what <C-o> does, whatever benefit you think you will get from doing that.