3

I really like the supertab plugin. Reaching <C-x><C-p> is a bit too long and mapping it to tab gives me a better workflow. However, sometime I just want to insert a regular tab and for this I need to insert a space first, i.e. foo<Space><Tab>bar.

This pollute my sources with useless spaces before each tab char (this assuming I don't use expandtab).

I am wondering is there is a smarter way to use auto-completion ?

  1. Going back to <C-x><C-p> which is much slower
  2. Using another key mapping like
  3. Using supertab with a wiser feature: i. Automatically insert a <Tab> if I press a char that doesn't match any of the possible completions. ii. Inserting a real tab with
  4. ???

Any ideas?

tshepang
  • 12,111
  • 21
  • 91
  • 136
nowox
  • 25,978
  • 39
  • 143
  • 293
  • 1
    FYI: It is more common to start completion via `` not ``. SuperTab defaults to using `` as well. `` is completion for just the current file which is different from standard `` which uses a few more sources (See `:h 'completeopt'). In my opinion it is best to rip off the SuperTab bandaid and learn to love `` and friends – Peter Rincker May 29 '14 at 14:34
  • I love your idea Peter. Unfortunately, I have a big issue with this. Because our world is not perfect a lot of people prefer using other *bad* editors. When I have to use them because I do not have any other choice, I feel lost and all my attempts getting polymorphic reflexes were unsuccessful. Thus, I'm trying to bring vim's behaviour a bit closer to the evil "standard". – nowox May 29 '14 at 14:55

2 Answers2

3

You can suppress the Supertab trigger and insert a literal tab by pressing <C-v><Tab>. (On Windows, that frequently is <C-q><Tab>.)

Supertab also provides a mapping for direct input, by default <C-Tab>; see :help supertab-mappingtabliteral. That default key combination probably only works in GVIM, though.

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
0

Just another try.

You can have a global substitute after editing work like:

:%s/ \t /\t/g
Sisyphus
  • 896
  • 11
  • 19
  • Not a bad idea. Can be useful in my "reformat" script which removes trailling spaces and do some other things – nowox May 29 '14 at 14:46