3

I am using gVim on Windows, and have only recently run into a very problematic situation: my Tab key stops working in insert mode! Pressing the Tab key does not give any output.

In order to use the plugin snipmate which expands snippets by calling a function defined as <Plug>-function, I have to remap ctrl+q to achieve the functionality. However, when I map the same content to Tab, pressing the key is still not bringing me anything.

I checked the mappings defined for <tab> using two methods:

  1. Using Listmaps plugin, by calling the command :Listmaps, and found that <tab> has been defined correctly;
  2. The mapping on <tab> seems to be valid upon checking :map <tab>;

Nevertheless, Tab seems to have been disabled.

What I don't understand is that: how come the same syntax of mapping would bring about different results. Who should I specify the <Plug>Func() mappings? If this is really wired, would it be worth it to try a fresh installation?

Thank you!

The pair of mappings that I have specified:

imap <c-q> <Plug>snipMateNextOrTrigger
imap <tab> <Plug>snipMateNextOrTrigger
2
  • Is it possible that Vim is not able to detect the Tab key being pressed? Commented Jul 5, 2016 at 9:10
  • check set paste?. If the output is not nopaste, turn off paste mode, the mappings should work fine then. Disable pastemode by default, and add something like set pastetoggle=<F2> to your vimrc file Commented Jan 6, 2017 at 17:23

1 Answer 1

0

You might need to add <esc>a, especially if you are using YouCompleteMe plugin along with SnipMate.

imap <tab> <esc>a<Plug>snipMateNextOrTrigger

Also verify that tab key is working by pressing ctrl+i, as it is identical to <tab> in Vim.

Finally, check your .vimrc if there is set paste, and remove that line if it exists or replace it with set nopaste.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.