Skip to content

Commit 9baa853

Browse files
authored
Merge pull request #86 from TTWShell/feature/vim-plug
Feature/vim plug
2 parents e84d447 + 017b262 commit 9baa853

File tree

5 files changed

+67
-72
lines changed

5 files changed

+67
-72
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,4 @@ compiler:
4747

4848
script:
4949
- ./install.sh INIT
50-
- sudo vim +PluginClean +qall
50+
- vim +PluginClean +qall

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ vim扩展管理器使用的是Vundle,参见相关文档[3]。
7575

7676
8. :w 保存文件可能会慢的情况,F6关闭语法检查。
7777

78+
9. golang第三方库自动补全无效:
79+
80+
执行vim-go命令 `:GoInstallBinaries`即可修复,可能报错:
81+
82+
错误信息: vim-go: gogetdoc not found. Installing github.com/zmb3/gogetdoc to folder /usr/local/opt/go/libexec/bin
83+
xxx timeout
84+
85+
可能的原因是PATH配置错误,需要加上$GOPATH/bin。即:
86+
87+
git clone https://github.com/golang/tools $GOPATH/golang.org/x/tools # 直接安装gotools
88+
export PATH=$GOPATH/bin:$PATH
89+
7890

7991
# 快捷键说明
8092

install-plugins.sh

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,31 @@
33
function install {
44
ln -s -f `pwd`/vimrc $HOME/.vimrc
55
touch $HOME/.vimrc.local
6-
yes "" | vim +PluginClean +qall
7-
yes "" | vim +PluginInstall +qall
6+
yes "" | vim +PlugClean +qall
7+
yes "" | vim +PlugInstall +qall
88
}
99

1010
function update {
11-
yes "" | vim +PluginUpdate +qall
11+
yes "" | vim +PlugUpdate +qall
12+
yes "" | vim +PlugUpgrade +qall
1213
}
1314

1415
function init {
15-
echo ">>> Set up Vundle ..."
16-
rm -rf ~/.vim/bundle/Vundle.vim
17-
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
16+
echo ">>> Set up plug.vim ..."
17+
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
18+
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
1819

19-
pip install flake8 # for vim-flake8
20+
sudo pip install flake8 # for vim-flake8
2021

2122
install
2223

23-
mkdir -p ~/.vim/colors && cp ~/.vim/bundle/vim-colorschemes/colors/* ~/.vim/colors
24+
mkdir -p ~/.vim/colors && cp ~/.vim/plugged/vim-colorschemes/colors/* ~/.vim/colors
2425

2526
rebuild --gocode-completer
2627
}
2728

2829
function rebuild() {
29-
set -e
30-
set -o pipefail
31-
cd ~/.vim/bundle/YouCompleteMe && git submodule update --init --recursive && ./install.py "$@"
30+
cd ~/.vim/plugged/YouCompleteMe && git submodule update --init --recursive && ./install.py "$@"
3231
}
3332

3433
function usage {

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ for i in "Centos","Centos" "Ubuntu","Ubuntu" "Darwin","MacOSX"; do
2828
key=${i%,*}; value=${i#*,};
2929
if [ `python -mplatform | grep -ic $key` == 1 ]; then
3030
platform=$value
31-
echoo ">>> You os is $platform."
31+
echoo ">>> Your os is $platform."
3232
fi
3333
done
3434

vimrc

Lines changed: 43 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,76 @@
1-
set nocompatible " be iMproved, required
2-
set backspace=indent,eol,start
3-
filetype off " required
4-
5-
" set the runtime path to include Vundle and initialize
6-
set rtp+=~/.vim/bundle/Vundle.vim
7-
call vundle#begin()
8-
" alternatively, pass a path where Vundle should install plugins
9-
"call vundle#begin('~/some/path/here')
10-
11-
" let Vundle manage Vundle, required
12-
Plugin 'VundleVim/Vundle.vim'
1+
" Specify a directory for plugins
2+
" - For Neovim: ~/.local/share/nvim/plugged
3+
" - Avoid using standard Vim directory names like 'plugin'
4+
call plug#begin('~/.vim/plugged')
135

6+
" Make sure you use single quotes
147

8+
" async syntax checking plugin for Vim
159
"""""""""""""""""""""""""""""""""""""""""""""
1610
" personal plugin start "
1711
"""""""""""""""""""""""""""""""""""""""""""""
1812
" async syntax checking plugin for Vim
19-
Plugin 'w0rp/ale'
13+
Plug 'w0rp/ale', {'tag': 'b934dc5'}
2014

2115
" Highlights trailing whitespace in red and provides
22-
Plugin 'bronson/vim-trailing-whitespace'
16+
Plug 'bronson/vim-trailing-whitespace'
2317

2418
" multiple selections
25-
Plugin 'terryma/vim-multiple-cursors'
19+
Plug 'terryma/vim-multiple-cursors'
2620

2721
" Colorthemes
28-
Plugin 'altercation/vim-colors-solarized'
29-
Plugin 'jnurmine/Zenburn'
30-
Plugin 'flazz/vim-colorschemes'
22+
Plug 'altercation/vim-colors-solarized'
23+
Plug 'jnurmine/Zenburn'
24+
Plug 'flazz/vim-colorschemes'
3125

3226
" best auto complete tool I have ever used(jedi, supertab...)
33-
Plugin 'Valloric/YouCompleteMe'
27+
Plug 'Valloric/YouCompleteMe', {'tag': '1e38a2b'}
3428

3529
" tree explore plugin
36-
Plugin 'scrooloose/nerdtree'
37-
Plugin 'Xuyuanp/nerdtree-git-plugin'
30+
Plug 'scrooloose/nerdtree'
31+
Plug 'Xuyuanp/nerdtree-git-plugin'
3832

3933
" show venv、git branch、file
4034
" Plugin 'Lokaltog/powerline', {'rtp': 'powerline/bindings/vim/'}
41-
Plugin 'vim-airline/vim-airline'
42-
Plugin 'vim-airline/vim-airline-themes'
35+
Plug 'vim-airline/vim-airline'
36+
Plug 'vim-airline/vim-airline-themes'
4337

4438
" enhance za
45-
Plugin 'tmhedberg/SimpylFold'
39+
Plug 'tmhedberg/SimpylFold'
4640

4741
" super search
48-
Plugin 'kien/ctrlp.vim'
42+
Plug 'kien/ctrlp.vim'
4943

5044
" a vim plug-in which provides support for expanding abbreviations similar to emmet.
51-
Plugin 'mattn/emmet-vim'
45+
Plug 'mattn/emmet-vim'
5246

5347
" Syntaxes
54-
Plugin 'Glench/Vim-Jinja2-Syntax'
55-
Plugin 'othree/html5.vim'
56-
Plugin 'vim-scripts/nginx.vim'
57-
Plugin 'fatih/vim-go'
58-
Plugin 'othree/javascript-libraries-syntax.vim'
59-
Plugin 'hynek/vim-python-pep8-indent'
60-
Plugin 'elzr/vim-json'
61-
Plugin 'dyng/ctrlsf.vim'
62-
Plugin 'kylef/apiblueprint.vim'
48+
Plug 'Glench/Vim-Jinja2-Syntax'
49+
Plug 'othree/html5.vim'
50+
Plug 'vim-scripts/nginx.vim'
51+
Plug 'fatih/vim-go'
52+
Plug 'othree/javascript-libraries-syntax.vim'
53+
Plug 'hynek/vim-python-pep8-indent'
54+
Plug 'elzr/vim-json'
55+
Plug 'dyng/ctrlsf.vim'
56+
Plug 'kylef/apiblueprint.vim'
6357

6458
" A Git wrapper so awesome
65-
Plugin 'tpope/vim-fugitive'
59+
Plug 'tpope/vim-fugitive'
6660
" A Vim plugin which shows a git diff in the gutter (sign column) and stages/undoes hunks.
67-
Plugin 'airblade/vim-gitgutter'
68-
69-
" All of your Plugins must be added before the following line
70-
call vundle#end() " required
71-
filetype plugin indent on " required
72-
" To ignore plugin indent changes, instead use:
73-
"filetype plugin on
74-
"
75-
" Brief help
76-
" :PluginList - list configured plugins
77-
" :PluginInstall(!) - install (update) plugins
78-
" :PluginSearch(!) foo - search (or refresh cache first) for foo
79-
" :PluginClean(!) - confirm (or auto-approve) removal of unused plugins
80-
"
81-
" see :h vundle for more details or wiki for FAQ
82-
" Put your non-Plugin stuff after this line
61+
Plug 'airblade/vim-gitgutter'
8362

63+
" Initialize plugin system
64+
call plug#end()
65+
filetype plugin indent on
66+
syntax enable
67+
syntax on
8468

8569
" When vimrc is edited, reload it
8670
autocmd! BufWritePost ~/.vimrc source ~/.vimrc
8771

88-
72+
set nocompatible
73+
set backspace=indent,eol,start
8974
set encoding=utf-8
9075
set fencs=utf-8,gb2312,gbk " Sets the default encoding
9176
set nu
@@ -118,15 +103,15 @@ autocmd FileType * autocmd BufWritePre <buffer> :call <SID>StripTrailingWhitespa
118103
au BufNewFile,BufRead *.tpl set ft=html
119104

120105
" syntastic
121-
set nocompatible
122-
filetype off
123-
let &runtimepath.=',~/.vim/bundle/ale'
124-
filetype plugin on
106+
let &runtimepath.=',~/.vim/plugged/ale'
125107
let g:ale_sign_column_always = 0 " 一般需要实时检查,默认关闭
126108
let g:ale_lint_on_save = 1 " save file auto check
127109
let g:ale_lint_on_text_changed = 0 " for ale_lint_on_save = 1
128110
let g:ale_lint_on_enter = 0 " for ale_lint_on_save = 1
129111
map <F6> :ALEToggle \| echo 'g:ale_enabled =' g:ale_enabled<CR>
112+
let g:ale_echo_msg_error_str = 'Error'
113+
let g:ale_echo_msg_warning_str = 'Warning'
114+
let g:ale_echo_msg_format = '[%linter%] %s [%severity%]'
130115

131116
" YouCompleteMe settings
132117
let g:ycm_collect_identifiers_from_comments_and_strings = 0
@@ -146,15 +131,14 @@ let g:ycm_autoclose_preview_window_after_insertion = 1
146131
let g:ycm_python_binary_path = 'python'
147132
map <C-G> :YcmCompleter GoToDefinitionElseDeclaration<CR>
148133
" fix .cpp error: ValueError: Still no compile flags, no completions yet.
149-
let g:ycm_global_ycm_extra_conf = '~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
134+
let g:ycm_global_ycm_extra_conf = '~/.vim/plugged/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
150135
" Vim's autocomplete is excruciatingly slow
151136
" http://stackoverflow.com/questions/2169645/vims-autocomplete-is-excruciatingly-slow
152137
set complete-=i
153138

154139
"""""""""""""""""""""""""""""""""""""""""""""
155140
" Vim UI "
156141
"""""""""""""""""""""""""""""""""""""""""""""
157-
syntax on
158142
au BufNewFile,BufRead *
159143
\ set tabstop=4 |
160144
\ set softtabstop=4 |

0 commit comments

Comments
 (0)