diff --git a/.travis.yml b/.travis.yml index a5aa1a8..b589be9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,4 +47,4 @@ compiler: script: - ./install.sh INIT - - sudo vim +PluginClean +qall + - vim +PluginClean +qall diff --git a/README.md b/README.md index eff14ef..a0b173c 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,18 @@ vim扩展管理器使用的是Vundle,参见相关文档[3]。 8. :w 保存文件可能会慢的情况,F6关闭语法检查。 +9. golang第三方库自动补全无效: + + 执行vim-go命令 `:GoInstallBinaries`即可修复,可能报错: + + 错误信息: vim-go: gogetdoc not found. Installing github.com/zmb3/gogetdoc to folder /usr/local/opt/go/libexec/bin + xxx timeout + + 可能的原因是PATH配置错误,需要加上$GOPATH/bin。即: + + git clone https://github.com/golang/tools $GOPATH/golang.org/x/tools # 直接安装gotools + export PATH=$GOPATH/bin:$PATH + # 快捷键说明 diff --git a/install-plugins.sh b/install-plugins.sh index f408f5e..6c7c256 100755 --- a/install-plugins.sh +++ b/install-plugins.sh @@ -3,32 +3,31 @@ function install { ln -s -f `pwd`/vimrc $HOME/.vimrc touch $HOME/.vimrc.local - yes "" | vim +PluginClean +qall - yes "" | vim +PluginInstall +qall + yes "" | vim +PlugClean +qall + yes "" | vim +PlugInstall +qall } function update { - yes "" | vim +PluginUpdate +qall + yes "" | vim +PlugUpdate +qall + yes "" | vim +PlugUpgrade +qall } function init { - echo ">>> Set up Vundle ..." - rm -rf ~/.vim/bundle/Vundle.vim - git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim + echo ">>> Set up plug.vim ..." + curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ + https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim - pip install flake8 # for vim-flake8 + sudo pip install flake8 # for vim-flake8 install - mkdir -p ~/.vim/colors && cp ~/.vim/bundle/vim-colorschemes/colors/* ~/.vim/colors + mkdir -p ~/.vim/colors && cp ~/.vim/plugged/vim-colorschemes/colors/* ~/.vim/colors rebuild --gocode-completer } function rebuild() { - set -e - set -o pipefail - cd ~/.vim/bundle/YouCompleteMe && git submodule update --init --recursive && ./install.py "$@" + cd ~/.vim/plugged/YouCompleteMe && git submodule update --init --recursive && ./install.py "$@" } function usage { diff --git a/install.sh b/install.sh index 2dd0b66..a2dad10 100755 --- a/install.sh +++ b/install.sh @@ -28,7 +28,7 @@ for i in "Centos","Centos" "Ubuntu","Ubuntu" "Darwin","MacOSX"; do key=${i%,*}; value=${i#*,}; if [ `python -mplatform | grep -ic $key` == 1 ]; then platform=$value - echoo ">>> You os is $platform." + echoo ">>> Your os is $platform." fi done diff --git a/vimrc b/vimrc index 20c5008..329d325 100644 --- a/vimrc +++ b/vimrc @@ -1,91 +1,76 @@ -set nocompatible " be iMproved, required -set backspace=indent,eol,start -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 'VundleVim/Vundle.vim' +" Specify a directory for plugins +" - For Neovim: ~/.local/share/nvim/plugged +" - Avoid using standard Vim directory names like 'plugin' +call plug#begin('~/.vim/plugged') +" Make sure you use single quotes +" async syntax checking plugin for Vim """"""""""""""""""""""""""""""""""""""""""""" " personal plugin start " """"""""""""""""""""""""""""""""""""""""""""" " async syntax checking plugin for Vim -Plugin 'w0rp/ale' +Plug 'w0rp/ale', {'tag': 'b934dc5'} " Highlights trailing whitespace in red and provides -Plugin 'bronson/vim-trailing-whitespace' +Plug 'bronson/vim-trailing-whitespace' " multiple selections -Plugin 'terryma/vim-multiple-cursors' +Plug 'terryma/vim-multiple-cursors' " Colorthemes -Plugin 'altercation/vim-colors-solarized' -Plugin 'jnurmine/Zenburn' -Plugin 'flazz/vim-colorschemes' +Plug 'altercation/vim-colors-solarized' +Plug 'jnurmine/Zenburn' +Plug 'flazz/vim-colorschemes' " best auto complete tool I have ever used(jedi, supertab...) -Plugin 'Valloric/YouCompleteMe' +Plug 'Valloric/YouCompleteMe', {'tag': '1e38a2b'} " tree explore plugin -Plugin 'scrooloose/nerdtree' -Plugin 'Xuyuanp/nerdtree-git-plugin' +Plug 'scrooloose/nerdtree' +Plug 'Xuyuanp/nerdtree-git-plugin' " show venv、git branch、file " Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'} -Plugin 'vim-airline/vim-airline' -Plugin 'vim-airline/vim-airline-themes' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' " enhance za -Plugin 'tmhedberg/SimpylFold' +Plug 'tmhedberg/SimpylFold' " super search -Plugin 'kien/ctrlp.vim' +Plug 'kien/ctrlp.vim' " a vim plug-in which provides support for expanding abbreviations similar to emmet. -Plugin 'mattn/emmet-vim' +Plug 'mattn/emmet-vim' " Syntaxes -Plugin 'Glench/Vim-Jinja2-Syntax' -Plugin 'othree/html5.vim' -Plugin 'vim-scripts/nginx.vim' -Plugin 'fatih/vim-go' -Plugin 'othree/javascript-libraries-syntax.vim' -Plugin 'hynek/vim-python-pep8-indent' -Plugin 'elzr/vim-json' -Plugin 'dyng/ctrlsf.vim' -Plugin 'kylef/apiblueprint.vim' +Plug 'Glench/Vim-Jinja2-Syntax' +Plug 'othree/html5.vim' +Plug 'vim-scripts/nginx.vim' +Plug 'fatih/vim-go' +Plug 'othree/javascript-libraries-syntax.vim' +Plug 'hynek/vim-python-pep8-indent' +Plug 'elzr/vim-json' +Plug 'dyng/ctrlsf.vim' +Plug 'kylef/apiblueprint.vim' " A Git wrapper so awesome -Plugin 'tpope/vim-fugitive' +Plug 'tpope/vim-fugitive' " A Vim plugin which shows a git diff in the gutter (sign column) and stages/undoes hunks. -Plugin 'airblade/vim-gitgutter' - -" 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 +Plug 'airblade/vim-gitgutter' +" Initialize plugin system +call plug#end() +filetype plugin indent on +syntax enable +syntax on " When vimrc is edited, reload it autocmd! BufWritePost ~/.vimrc source ~/.vimrc - +set nocompatible +set backspace=indent,eol,start set encoding=utf-8 set fencs=utf-8,gb2312,gbk " Sets the default encoding set nu @@ -118,15 +103,15 @@ autocmd FileType * autocmd BufWritePre :call StripTrailingWhitespa au BufNewFile,BufRead *.tpl set ft=html " syntastic -set nocompatible -filetype off -let &runtimepath.=',~/.vim/bundle/ale' -filetype plugin on +let &runtimepath.=',~/.vim/plugged/ale' let g:ale_sign_column_always = 0 " 一般需要实时检查,默认关闭 let g:ale_lint_on_save = 1 " save file auto check let g:ale_lint_on_text_changed = 0 " for ale_lint_on_save = 1 let g:ale_lint_on_enter = 0 " for ale_lint_on_save = 1 map :ALEToggle \| echo 'g:ale_enabled =' g:ale_enabled +let g:ale_echo_msg_error_str = 'Error' +let g:ale_echo_msg_warning_str = 'Warning' +let g:ale_echo_msg_format = '[%linter%] %s [%severity%]' " YouCompleteMe settings let g:ycm_collect_identifiers_from_comments_and_strings = 0 @@ -146,7 +131,7 @@ let g:ycm_autoclose_preview_window_after_insertion = 1 let g:ycm_python_binary_path = 'python' map :YcmCompleter GoToDefinitionElseDeclaration " fix .cpp error: ValueError: Still no compile flags, no completions yet. -let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' +let g:ycm_global_ycm_extra_conf = '~/.vim/plugged/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py' " Vim's autocomplete is excruciatingly slow " http://stackoverflow.com/questions/2169645/vims-autocomplete-is-excruciatingly-slow set complete-=i @@ -154,7 +139,6 @@ set complete-=i """"""""""""""""""""""""""""""""""""""""""""" " Vim UI " """"""""""""""""""""""""""""""""""""""""""""" -syntax on au BufNewFile,BufRead * \ set tabstop=4 | \ set softtabstop=4 |