1

I have supertab installed alongside with vim-go.

Next, I'd like to have autocomplete when writing in Go, but when I press tab its literally inserts a tab character instead of showing the autocomplete prompt.

I tried to add the following in my vimrc but it didn't help:

let g:SuperTabDefaultCompletionType = "context"

or:

let g:SuperTabContextDefaultCompletionType = "<c-x><c-o>"

<c-x><c-o> works fine to start autocomplete, but I can't get anything with tab.

What am I doing wrong here?

UPD :verbose imap <Tab> result is:

i  <Tab>         <Plug>SuperTabForward
        Last set from ~/.vim/plugged/supertab/plugin/supertab.vim line 
1011
setevoy
  • 141
  • 4
  • I tried your first line "context" with a minimal installation. After a restart of vim fmt.<tab> showed the omni completion candidates. For debugging try to use supertab without the context feature by setting in your vimrc let g:SuperTabDefaultCompletionType = "<c-x><c-o>" (none of the one you posted). This should try only omni completion on tab. You should also add to your question the result of :imap <Tab>. – Hotschke Nov 20 '18 at 15:46
  • @Hotschke Thanks. I have tried to add let g:SuperTabDefaultCompletionType = "<c-x><c-o>" - but still the same result - pressing the TAB button after ftm. results to adding tabulation. Also, I updated my Q with the :verbose imap <Tab> output. – setevoy Nov 20 '18 at 16:01
  • 1
    This is weird. Do you use a minimal setup: minimal vimrc and only the two plugins in question? Could you also add $vim -version | head, terminal/gui in use, OS? Maybe there is something wrong with the keycode sent to vim. – Hotschke Nov 20 '18 at 16:05
  • @Hotschke That's it! Thanks. Made new clean file without any plugins excepting fatih/vim-go and ervandew/supertab - and it works now. Now just will have to find which plugin brokes my setup :-) Maybe worth to add your comments as an answer - so I'll mark it as Accepted? – setevoy Nov 20 '18 at 16:09
  • It was set paste option... Weird :-| – setevoy Nov 20 '18 at 16:13
  • I am not sure whether the advice to disable other plugins qualifies as an answer. There is already the important question https://vi.stackexchange.com/questions/2003/how-do-i-debug-my-vimrc-file. The answer https://vi.stackexchange.com/a/2004/1292 already suggests to isolate plugin(s). I feel like this question should simply link to this for others who struggle to setup supertab and vim-go as well. – Hotschke Nov 20 '18 at 16:14
  • You can also post an answer with the solution to your problem! – Hotschke Nov 20 '18 at 16:15
  • 1
    BTW there is a faq in the README.md of supertab mentioning the following: "make sure you don't have the paste option enabled in your vimrc or elsewhere." – Hotschke Nov 20 '18 at 16:18
  • 2
    @setevoy self-answering is a part of the SE model; please post your solution as an answer if it solved your problem. – D. Ben Knoble Nov 20 '18 at 17:53

1 Answers1

3

Thanks to @Hotschke's comments.

  1. run vim without any plugins/options excepting supertab and vim-go
  2. enable options/plugins one-by-one
  3. find that the set paste option was the cause

Useful links related to this "issue":

https://github.com/ervandew/supertab/blob/master/README.rst

make sure you don't have the paste option enabled in your vimrc or elsewhere

How do I debug my vimrc file?

setevoy
  • 141
  • 4