GOLANG-OSX configuration Vim under the Golang development environment (MacOS as an example)

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

Test environment

MacOS 10.12.6

First install Vim

Brew Install Vim

I have installed the Vim 8.0 version

Then install Vundle, which is a VIM package Manager

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

Then edit the ~/.VIMRC file

This is my. vimrc file

You can copy the following configuration contents into your. vimrc file

Set nocompatible              "be improved, requiredfiletype off                  " Requiredset backspace=2set modelines=0syntax onset ts= 4set expandtab%retab! "Set numberautocmd bufwritepre *.go:fmtset rtp+=~/.vim/bundle/vundle/call vundle#rc ()" Let Vundle Manage Vundle "required! Bundle ' Gmarik/vundle ' can be specified by the following four ways to specify the source of the plug-in "a" to specify GitHub in the Vim-scripts warehouse plug-ins, directly specify the plug-in name, plug-in in the white space using "-" instead. Bundle ' L9 ' B) specifies the plug-in for other user repositories in GitHub, using the "username/Plugin Name" method to specify bundle ' tpope/vim-fugitive ' bundle ' lokaltog/ Vim-easymotion ' bundle ' rstacruz/sparkup ', {' RTP ': ' vim/'}bundle ' tpope/vim-rails.git ' bundle ' dgryski/ Vim-godef ' bundle ' blackrush/vim-gocode ' bundle ' Majutsushi/tagbar ' "C" specifies a plugin for a non-GitHub git repository that requires the use of Git address Bundle ' git:// Git.wincent.com/command-t.git ' "D) specifies the plugin in the local git repository" Bundle ' file:///Users/gmarik/path/to/plugin ' filetype plugin indent On     "required!

Then start installing the Vundle plugin

Enter at the command line first

Vim

And then enter

: Bundleinstall  

See here for some introduction to Vundle http://blog.csdn.net/jiaolongdy/article/details/17889787/

You can add the following line to your. vimrc file, which is automatically formatted each time Vim saves the go source file

Autocmd Bufwritepre *.go:fmt

In fact, do not add, measured added no eggs, excerpted from other information, first mark

Reference here: http://ju.outofmemory.cn/entry/89207

I'm going to write this for a moment, and then I'm ready to write it.

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.