大佬教程收集整理的这篇文章主要介绍了golang的vim工作环境配置,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
简易配置
" Remember last position if has("autOCMd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif endif filetype on Syntax on set showcmd set ruler " enable BACkspace set BACkspace=indent,eol,start set nu set mouse= set ts=4 sts=4 sw=4 set encoding=utf-8 " set expandtab " set completeopt=longest,menu autOCMd Filetype python set ts=4 sts=4 expandtab autOCMd FileType python setlocal omnifunc=pythoncomplete#Complete autOCMd Filetype java setlocal omnifunc=javacomplete#Complete@H_489_5@https://code.google.com/p/go/source/browse/misc/vim/readme.txt
基础工具安装
go get github.com/bradfitz/goimports
go get github.com/nsf/gocode
go get code.google.com/p/rog-go/EXP/cmd/godef
git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim@H_489_5@然后修改vimrc
set nocompatible " be iMproved,required filetype off " required " set the runtime path to include Vundle and initialize set rtp+=~/.vim/bundle/Vundle.vim call vundle#begin() " alternatively,pass a path where Vundle should install plugins "call vundle#begin('~/some/path/here') " let Vundle manage Vundle,required Plugin 'gmarik/Vundle.vim' " The following are examples of different formats supported. " Keep Plugin commands between vundle#begin/end. " plugin on GitHub repo "Plugin 'tpope/vim-fugitive' " plugin from http://vim-scripts.org/vim/scripts.html "Plugin 'L9' " Git plugin not hosted on GitHub "Plugin 'git://git.wincent.com/command-t.git' " git repos on your local machine (i.e. when working on your own plugin) "Plugin 'file:///home/gmarik/path/to/plugin' " The sparkup vim script is in a subdirectory of this repo called vim. " Pass the path to set the runtimepath properly. "Plugin 'rstacruz/sparkup',{'rtp': 'vim/'} " Avoid a name conflict with L9 "Plugin 'user/L9',{'name': 'newL9'} " "Plugin 'gmarik/vundle' " ... other plugin "Plugin 'Valloric/YouCompleteMe' Plugin 'python.vim' Plugin 'cespare/vim-golang' Plugin 'Blackrush/vim-gocode' Plugin 'pylint.vim' " template Plugin 'pathogen.vim' Plugin 'aperezdc/vim-template' " snippets Plugin 'SirVer/ultisnips' Plugin 'honza/vim-snippets' let g:UltiSnipsExpandtrigger="<tab>" let g:UltiSnipsJumpFor@R_@R_696_11277@_10225@trigger="<c-b>" let g:UltiSnipsJumpBACk@R_@R_696_11277@_10225@trigger="<c-z>" " If you want :UltiSnipsEdit to split your window. let g:UltiSnipsEditSplit="vertical" " All of your Plugins must be added before the following line call vundle#end() " required filetype plugin indent on " required " To ignore plugin indent changes,instead use: "filetype plugin on " " Brief Help " :PluginList - list configured plugins " :PluginInstall(!) - install (updatE) plugins " :PluginSearch(!) foo - search (or refresh cache first) for foo " :PluginClean(!) - confirm (or auto-approvE) removal of unused plugins " " see :h vundle for more details or wiki for FAQ " Put your non-Plugin stuff after this line " " Remember last position if has("autOCMd") au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g`\"" | endif endif " "set omnifunc=Syntaxcomplete#Complete "set completeopt=longest,menu let g:gofmt_command = "goimports" autOCMd BufWritePre *.go :Fmt Syntax on set showcmd set ruler " enable BACkspace set BACkspace=indent,menu autOCMd Filetype python set ts=4 sts=4 expandtab autOCMd FileType python setlocal omnifunc=pythoncomplete#Complete autOCMd Filetype java setlocal omnifunc=javacomplete#Complete@H_489_5@开启vim,命令模式下执行
:PluginInstall
如果发现自动补全不好使,再来一步
(cd $GOPATH/src/github.com/nsf/gocode && vim/update.sh)@H_489_5@下面的忽略,验证了下,会跟其他插件有冲突
安装YCM(主要是youcompleteme需要) cd ~/.vim/bundle/YouCompleteMe && ./install.shsnipets修改:
.vim/bundle/vim-snippets/snippets/go.snippets
大佬总结
以上是大佬教程为你收集整理的golang的vim工作环境配置全部内容,希望文章能够帮你解决golang的vim工作环境配置所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。