Golang's VIM working environment configuration

Source: Internet
Author: User
Tags gocode
This is a creation in Article, where the information may have evolved or changed.

Https://code.google.com/p/go/source/browse/misc/vim/readme.txt

If you encounter local compilation problems, you can use Http://gobuild.io to fix

Basic tool Installation

    • Installing Goimportsgo get github.com/bradfitz/goimports
    • Installing Gocodego get github.com/nsf/gocode
    • Installing Godefgo get code.google.com/p/rog-go/exp/cmd/godef
    • Install vim (this does not speak, requires a high version)

Vundle Installation and Configuration

Install Vundle, which is a plugin for managing vim plugins. Very powerful.

Installation method I copied it directly from the GitHub page.

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

Then modify the VIMRC

Set nocompatible              "be improvedfiletype off                  " Required!set rtp+=~/.vim/bundle/vundle/call VUNDLE#RC () "Let Vundle Manage Vundle "required! Bundle ' Gmarik/vundle ' bundle ' Cespare/vim-golang ' bundle ' blackrush/vim-gocode ' "bundle ' valloric/youcompleteme '" ... Other Pluginsyntax onfiletype plugin indent on     "required!" " Brief Help ": Bundlelist          -List configured bundles": Bundleinstall (!)    -Install (update) Bundles ": Bundlesearch (!) Foo-search (or refresh cache first) for Foo": Bundleclean (!)      -Confirm (or auto-approve) removal of unused bundles "" see:h vundle for more details or wiki for FAQ "note:comments aft Er Bundle commands is not allowed. " Set Omnifunc=syntaxcomplete#complete    set Completeopt=longest,menuautocmd bufwritepre *.go:fmtset showcmdset Ruler "Enable Backspaceset Backspace=indent,eol,startset Nuset mouse=

Turn on vim, execute in command mode:BunduleInstall

If you find that automatic completion is not so, one more step.

CD $GOPATH/src/github.com/nsf/gocode && vim/update.sh

The following ignore, verified, will conflict with other plugins

Install YCM (primarily youcompleteme required) CD ~/.vim/bundle/youcompleteme &&./install.sh

Enhanced Continuation (Installation snippets)

Reference source Https://github.com/garbas/vim-snipmate

VIMRC New

"Snipmatebundle" Marcweber/vim-addon-mw-utils "bundle" Tomtom/tlib_vim "bundle" Garbas/vim-snipmate "" Optional: Bundle "Honza/vim-snippets"

Open vim, run it again:BundleInstall

Put the inside of the memory is OK..vim/bundle/vim-snippets/snippets/go.snippets

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.