0

I thought I knew the answer to this.

I used to do <C-V> tab as suggested in "How to insert a real tab with Vim SuperTab plugin if completion fails" and many others.

If i set list though, I can see that I get an actual tab instead of my four spaces (with expandtab set) and that really messes up my code.

Is there a way to:

  1. write
  2. chooses some suggested autocompletion
  3. insert tab (as defined with expandtab)

1 Answer 1

1
  • SuperTab has a fallback; Ctrl + Tab by default. See :help g:SuperTabMappingTabLiteral. I think pressing this should suffice. (You can also change the config to use another key, or :inoremap <F1> <Tab> yourself).
  • You can conclude the completion with Ctrl + Y (cp. :help complete_CTRL-Y); this closes the popup menu and therefore the special handling of <Tab>.
  • If all that doesn't help, try concluding the completion by pressing Space, followed by Tab. The former avoids that SuperTab is triggered again, and the latter will expand the whitespace to the next tabstop value, and format it according to your indent settings.
1
  • Using Space and then Tab was just what I wanted to avoid since it could mean that your first space brings you to a tab-stop and the following tab takes you one more forward. CRTL-Y or CTRL_SPACE works fine though, thanks.
    – evading
    Jan 14, 2015 at 13:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .