I recently installed vim-go using pathogen, but the autocompletion feature is not working. If I am using it only shows commands I've already used. My .vimrc has
filetype plugin on
" Enable autocompletion
set omnifunc=syntaxcomplete#Complete
" Select keyword as you type
:set completeopt=longest,menuone
Do I need more than just this plugin? The other feature I have tested so far are working (:GoRun, syntax highlighting). This is on a Ubuntu machine.
The syntaxcomplete#Complete
ships with Vim, not the Go filetype plugin, and it has very limited capabilities (basically, just offering the language's keywords). No wonder you're disappointed.
The ftplugin/go.vim
file sets the correct, custom completion of the vim-go plugin:
setlocal omnifunc=go#complete#Complete
So, just ensure that the 'filetype'
setting is correct (go
), and that you don't have any additional configuration that overrides the plugin's.
:verbose setlocal omnifunc?
can tell you.