11

When I loop through the list of completion alternatives via supertab (i.e. activated by pressing <TAB>), the selection starts at the end of the list and cycles upwards when repeatedly pressing <TAB> or <C-n>. Pressing <S-TAB> or <C-p> cycles downwards.

The opposite behaviour, which I find more convenient, happens when the automatic completion is activated by the vim built-in (?), using <C-x><C-n>. Then <C-n> cycles downwards and <C-p> upwards.

I'm not too knowledgeable about vim. How can I fix this?

doubleDown
  • 8,048
  • 1
  • 32
  • 48
Patrick
  • 1,829
  • 19
  • 32
  • 2
    Always read the documentation of the plugin first. Your question is in the [Supertab FAQ](https://github.com/ervandew/supertab#frequently-asked-questions) – doubleDown Jun 14 '13 at 09:33

1 Answers1

20

This is because SuperTab's default completion is <C-p>, which cycles backwards (so matches before, not after the cursor are presented first, which is usually what you want). As documented, you can change that via:

let g:SuperTabDefaultCompletionType = "<c-n>"

(Put this into your ~/.vimrc.)

Ingo Karkat
  • 167,457
  • 16
  • 250
  • 324
  • Thanks. It worked for me. I thought it was due to some conflict between Supertab and YCM. After I put the above line in my .vimrc, it worked as expected. – Abinash Dash Jul 02 '20 at 14:40