Golang VIM Development environment settings

Source: Internet
Author: User
Tags git clone

1 Introduction

Previous blog We introduced the installation, compilation, and operation of Golang, this blog we describe how to set up a vim development environment for Golang. The native vim cannot identify the Golang keyword by itself, and the development environment is like editing plain text files, not highlighting, not to mention auto-complement function. To do this, we need to add the Golang-oriented plug-in vim-go to vim. At the same time, we also need to install Youcompleteme (YCM) According to the Vim-go installation boot.


2 Installing Vundle

Vundle git page https://github.com/VundleVim/Vundle.vim

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

3 Installing Vim-go

Vim-go git page https://github.com/fatih/vim-go

git clone https://github.com/fatih/vim-go.git ~/.vim/bundle/vim-go

4 Installing YCM

YCM git page https://github.com/Valloric/YouCompleteMe

4.1 Pre-conditions

Vim version 7.3.584 above

Installation dependencies

sudo apt-get install build-essential cmakesudo apt-get Install Python-dev

4.2 Git clone

git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/youcompleteme

4.3 Compiling the installation

Enter the ~/.vim/bundle/youcompleteme directory and execute

git submoduleupdate--init--recursive./install.py–clang-completer–gocode-completer

These two commands take a long time to execute, especially the first one, and you can do something else in parallel.


5 Configuration

Edit ~/.VIMRC

"-------------  " vundle   "https://github.com/gmarik/vundle.vim  "-------------     setnocompatible                " beiMproved, required  filetypeoff                    " required      " set theruntime path to include Vundle and initialize  Setrtp+=~/.vim/bundle/vundle.vim  callvundle#begin ()    "Alternatively, pass a  path where Vundle should install plugins   "Callvundle#begin (' ~/some/ Path/here ')      '  letvundle manage vundle, required  plugin ' Gmarik/vundle.vim '      '  thefollowing are examples of different  formats supported.   "  KeepPlugin commands between vundle#begin/end.  " pluginon github repo    "Plugin ' tpope/vim-fugitive '   "  pluginfrom http://vim-scripts.org/vim/ scripts.html  "" Plugin ' L9 '    " Gitplugin not hosted on GitHub    "Plugin ' Git://git.wincent.com/command-t.git '   "  gitrepos on your local  machine  (i.e. when working on your own plugin)    "plugin" File:///home/gmarik/path/to/plugin '    '  thesparkup vim script is in a  subdirectory of this repo called vim.   " Passthe path  to set the runtimepath properly.  "" Plugin ' rstacruz/sparkup ',  {' RTP ':  ' vim/' }   " Avoid aname conflict with L9  " "Plugin ' user/l9 ',  {' name ':  ' newL9 '} &NBsp;   " installvim-go  plugin ' fatih/vim-go '   "  install ycmplugin " Valloric/youcompleteme '     All ofyour Plugins must be added  Before the following line  callvundle#end ()               "required  filetypeplugin indent on    "  required   " Toignore plugin indent changes, instead use: " filetypeplugin on   "  "  Briefhelp   ":P luginlist        - lists configuredplugins   ":P lugininstall     - installs plugins;append  '! '  to update or just :P luginupdate  ': pluginsearch foo - searches for foo; append  '! '  to refresh  Local cache &nBSP; ":P luginclean      - confirms removal ofunused plugins;  append  '! '  to auto-approve removal   '    '  see :hvundle  for more details or wiki for FAQ   " putyour non-plugin  stuff after this line  set smarttabsetshiftwidth=4set tabstop= 4setsofttabstop=4set expandtabautocmdfiletype go set expandtab

6 References

Https://github.com/gmarik/Vundle.vim

http://studygolang.com/articles/2927

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

http://howiefh.github.io/2015/05/22/vim-install-youcompleteme-plugin/

Https://github.com/Valloric/YouCompleteMe

This article from "Talking Cabbage" blog, declined reprint!

Golang VIM Development environment settings

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.