Question

I'm on this computer (ubuntu) where TAB is mapped (I can't find where) to autocomplete. I searched and seems like this is done by supertab, although I couldn't find how to disable it, neither did I find its files.

In my ~/.vimrc and /usr/share/vim/vimrc files, there is no mapping of the tab key. The later file includes debian.vim (and tries with /etc/vim/vimrc.local, but that doesn't exist) but that also doesn't have any mappings of tab, or any reference to supertab.

The output of :map! is this:

i  <S-Tab>     * <C-R>=BackwardsSnippet()<CR>
i  <Plug>SuperTabBackward & <C-R>=<SNR>13_SuperTab('p')<CR>
i  <Plug>SuperTabForward & <C-R>=<SNR>13_SuperTab('n')<CR>
i  <C-Tab>     * <Tab>
i  <Tab>       * <C-R>=TriggerSnippet()<CR>
i  <CR>        * <C-R>=<SNR>13_SelectCompletion(1)<CR>
i  <C-N>         <Plug>SuperTabForward
i  <C-P>         <Plug>SuperTabBackward
i  <C-R><Tab>  * <C-R>=ShowAvailableSnips()<CR>
i  <C-X>         <C-R>=<SNR>13_ManualCompletionEnter()<CR>

Which indicates that supertab is indeed mapping these keys.

I tried putting nomap! <TAB> in my ~/.vimrc, but it doesn't work as it seems like supertab is being loaded after ~/.vimrc is read.

My question is, how can I disable supertab, or alternatively make sure ViM doesn't let anyone map TAB to anything else?

Was it helpful?

Solution

Supertab is a plugin. As such it should be installed somewhere in ~/.vim/. There are many ways to install plugins (default, pathogen, vundle, etc.). Look into ~/.vim/bundle (if you use Pathogen) or in ~/.vim/plugin.

If it's not there it may have been installed in /usr/share/vim/vim7x/ which is very crowded and should not be touched in any way: good luck.

Anyway, you can do :verbose map! to see where the mappings are set (and thus, where the plugin is installed if you want to remove it) or you could simply configure Supertab to not use <tab>. See :help supertab.

OTHER TIPS

In case you don't want to completely get rid of supertab you can remap the default keybindings using something like (in your ~/.vimrc):

let g:SuperTabMappingForward = '<c-space>'
let g:SuperTabMappingBackward = '<s-c-space>'

If you only want to insert literal tab characters, supertab makes it easy by mapping literal tabs to ctrl+tab by default (which unfortunately doesn't work in terminal). It can be customized by using something like:

g:SuperTabMappingTabLiteral='<C-`>'

Lastly, you can always escape a mapping by prepending it with ctrl-v in insert mode.

see :h supertab-forwardbackward for more information. (might not work if you haven't built supertab docs)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top