Skip to content

Commit

Permalink
Merge pull request #86 from TTWShell/feature/vim-plug
Browse files Browse the repository at this point in the history
Feature/vim plug
  • Loading branch information
TTWShell authored Nov 21, 2017
2 parents e84d447 + 017b262 commit 9baa853
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 72 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ compiler:

script:
- ./install.sh INIT
- sudo vim +PluginClean +qall
- vim +PluginClean +qall
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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


# 快捷键说明

Expand Down
21 changes: 10 additions & 11 deletions install-plugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
102 changes: 43 additions & 59 deletions vimrc
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -118,15 +103,15 @@ autocmd FileType * autocmd BufWritePre <buffer> :call <SID>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 <F6> :ALEToggle \| echo 'g:ale_enabled =' g:ale_enabled<CR>
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
Expand All @@ -146,15 +131,14 @@ let g:ycm_autoclose_preview_window_after_insertion = 1
let g:ycm_python_binary_path = 'python'
map <C-G> :YcmCompleter GoToDefinitionElseDeclaration<CR>
" 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

"""""""""""""""""""""""""""""""""""""""""""""
" Vim UI "
"""""""""""""""""""""""""""""""""""""""""""""
syntax on
au BufNewFile,BufRead *
\ set tabstop=4 |
\ set softtabstop=4 |
Expand Down

0 comments on commit 9baa853

Please sign in to comment.