12

What keys do <C-x><C-o> represent in Vim? My goal is to get autocompletions working for Golang.

I've installed this plugin and have the syntax highlighting working.

https://github.com/fatih/vim-go

The readme says that, "Autocompletion is enabled by default via <C-x><C-o>", but I don't know which keys to press.

425nesp
  • 6,936
  • 9
  • 50
  • 61
  • It should be those keys, considering they are mentioned in http://stackoverflow.com/q/7722177/6309 – VonC Jan 19 '15 at 09:37

3 Answers3

13

It's Ctrl+X, Ctrl+O. This combination is used in Vim for omnicompletion. Type :h omnifunc or :h ft-go-omni (I presume) for more information.

Don Reba
  • 13,814
  • 3
  • 48
  • 61
  • 2
    when i use this key combination, in insert mode, the window appaears , and first entry gets selected automatically and inserted. – weima Feb 08 '17 at 08:50
1
  • go is executable?

    do you add path to golang into $PATH?

  • vim-go is loaded?

    if you are using vim-plug or pluggable interface for plugins, you should have vim-go in ~/.vim/bundle

  • are you editing go file?

    check :set ft? is go

Community
  • 1
  • 1
mattn
  • 7,571
  • 30
  • 54
0

Do u execute ":GoInstallBinaries" in the vim?

And the bin path is add?

ps:

The default keybind is complex,

I recommend using neocomplete.vim by Shougo and add follows on the base configuration:

let g:neocomplete#sources#omni#input_patterns.go = '\h\w*\.\?'
inoremap <silent> <CR> <C-r>=<SID>my_cr_function()<CR>
function! s:my_cr_function()
    return pumvisible() ? neocomplete#close_popup() : "\<CR>"
endfunction
inoremap <expr><TAB>  pumvisible() ? "\<C-n>" : "\<TAB>"
Specode
  • 973
  • 9
  • 19