golang的vim工作环境配置
发布时间:2020-12-16 18:57:00 所属栏目:大数据 来源:网络整理
导读:2015-08-06更新 简易配置 " Remember last positionif has("autocmd")au BufReadPost * if line("'"") 1 line("'"") = line("$") | exe "normal! g`"" | endifendiffiletype onsyntax onset showcmdset ruler" enable backspaceset backspace=indent,eol,
2015-08-06更新简易配置 " 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 https://code.google.com/p/go/source/browse/misc/vim/readme.txt 基础工具安装
vundle安装和配置安装vundle,这是一个管理vim插件的插件。很强大。 安装方法我直接从github页面上拷贝了 git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim 然后修改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:UltiSnipsJumpForwardTrigger="<c-b>" let g:UltiSnipsJumpBackwardTrigger="<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 开启vim,命令模式下执行 如果发现自动补全不好使,再来一步 (cd $GOPATH/src/github.com/nsf/gocode && vim/update.sh) 下面的忽略,验证了下,会跟其他插件有冲突snipets修改: (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |