FAQ
Hi

I've got Vim working almost as I want it to with Go, but there are a couple
of things I'd really like and was wondering how I might set this up:

1. Auto code completion in insert mode, So as soon as I type a "." it shows
the possible completions. I already have gocode working but I need to
manually ask for completions.
2. Automatically run go fmt when I save a file.

Thanks
Ryan

--

Search Discussions

  • Kamil Kisiel at Nov 9, 2012 at 5:47 pm
    Not sure how to do the first one since I don't use code completion.

    For #2 I have in ~/.vim/ftplugin/go.vim:

    autocmd BufWritePre *.go :silent Fmt

    This assumes you're using the Vim plugins available in the Go
    distribution's misc/vim directory which provide the Fmt command.
    On Friday, November 9, 2012 8:19:23 AM UTC-8, Ryan Slade wrote:

    Hi

    I've got Vim working almost as I want it to with Go, but there are a
    couple of things I'd really like and was wondering how I might set this up:

    1. Auto code completion in insert mode, So as soon as I type a "." it
    shows the possible completions. I already have gocode working but I need to
    manually ask for completions.
    2. Automatically run go fmt when I save a file.

    Thanks
    Ryan
    --
  • Miki Tebeka at Nov 9, 2012 at 10:54 pm
    1. Auto code completion in insert mode, So as soon as I type a "." it
    shows the possible completions. I already have gocode working but I need to
    manually ask for completions.
    See http://vim.wikia.com/wiki/Omni_completion for several options on how to
    do that (mainly http://vim.wikia.com/wiki/VimTip1386).
    On Friday, November 9, 2012 8:19:23 AM UTC-8, Ryan Slade wrote:

    Hi

    I've got Vim working almost as I want it to with Go, but there are a
    couple of things I'd really like and was wondering how I might set this up:

    2. Automatically run go fmt when I save a file.

    Thanks
    Ryan
    --
  • Andrew Lytvynov at Nov 10, 2012 at 6:55 am
    https://github.com/Shougo/neocomplcache for #1 works pretty great with
    gocode (requires several additional lines in vimrc though)
    On Friday, November 9, 2012 6:19:23 PM UTC+2, Ryan Slade wrote:

    Hi

    I've got Vim working almost as I want it to with Go, but there are a
    couple of things I'd really like and was wondering how I might set this up:

    1. Auto code completion in insert mode, So as soon as I type a "." it
    shows the possible completions. I already have gocode working but I need to
    manually ask for completions.
    2. Automatically run go fmt when I save a file.

    Thanks
    Ryan
    --

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedNov 9, '12 at 4:19p
activeNov 10, '12 at 6:55a
posts4
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase