vim-go and YCM

2,065 views
Skip to first unread message

Sankar

unread,
Feb 25, 2015, 10:28:20 AM2/25/15
to golan...@googlegroups.com
Hi


In my ~/.vimrc I have:

" vim-go options
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1

" YCM options after these other plugins (the defaults of vim-go changed somehow)
let g:ycm_add_preview_to_completeopt = 0
let g:ycm_min_num_of_chars_for_completion = 1
let g:ycm_auto_trigger = 1
set completeopt-=preview

However, I do not get the autocomplete-as-you-type feature. I am forced to press control+space to autocomplete everytime.

How do I get to autocomplete without pressing control key ?

I am running on Linux (qvim) if it matters. Any help ?

Thanks.

Sankar

Fatih Arslan

unread,
Feb 25, 2015, 10:53:19 AM2/25/15
to Sankar, golang-nuts
Did you installed "gocode" ? It's needed by YCM and vim-go which does
the actual work. You can install it via ":GoInstallBinaries" (within
vim) or from the sources: https://github.com/nsf/gocode

And this is the vimrc I'm using which I use without any problems (you
might want to look at it for comparison):
https://github.com/fatih/dotfiles/blob/master/vimrc
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Sankar P

unread,
Feb 25, 2015, 10:59:06 AM2/25/15
to Fatih Arslan, golang-nuts
2015-02-25 21:22 GMT+05:30 Fatih Arslan <fa...@arslan.io>:
> Did you installed "gocode" ? It's needed by YCM and vim-go which does
> the actual work. You can install it via ":GoInstallBinaries" (within
> vim) or from the sources: https://github.com/nsf/gocode

Yes, I have installed gocode in my $GOPATH/bin/ folder. The $PATH also
has the same folder too.

>
> And this is the vimrc I'm using which I use without any problems (you
> might want to look at it for comparison):
> https://github.com/fatih/dotfiles/blob/master/vimrc

I checked it but could not find anything different. My .vimrc is at:
https://github.com/psankar/vimrc/blob/master/.vimrc

Can you spot any error ?

Thanks for all your efforts in packaging vim-go. It is very helpful :-D
--
Sankar P
http://psankar.blogspot.com

mgutz

unread,
Feb 25, 2015, 1:47:26 PM2/25/15
to golan...@googlegroups.com, fa...@arslan.io
I also have this in my vimrc (not sure if it will help)

""" YouCompleteMe
let g:ycm_semantic_triggers =  {
  \   'c' : ['->', '.'],
  \   'go' : ['.'],
  \   'objc' : ['->', '.'],
  \   'cpp,objcpp' : ['->', '.', '::'],
  \   'perl' : ['->'],
  \   'php' : ['->', '::'],
  \   'cs,java,javascript,d,vim,ruby,python,perl6,scala,vb,elixir,go' : ['.'],
  \   'lua' : ['.', ':'],
  \   'erlang' : [':'],
  \ }

I get autocompletion on dot.

Steve Sauls

unread,
Feb 25, 2015, 8:14:49 PM2/25/15
to golan...@googlegroups.com
Here's what I did on Linux Mint.  I get everything except autocomplete though.

sudo apt-get install vim-gocomplete gocode vim-syntax-go vim-addon-manager
vim-addon-manager install go-syntax
vim-addon-manager install gocode

aleksand...@gmail.com

unread,
Aug 22, 2016, 10:39:38 AM8/22/16
to golang-nuts
Had the same issue.
What worked for me is https://github.com/Valloric/YouCompleteMe#ubuntu-linux-x64, run './install.py --gocode-completer', and now enjoying real-time completion.
Reply all
Reply to author
Forward
0 new messages