From 5f2153337eaf9931668e355776db6bca175ebb68 Mon Sep 17 00:00:00 2001 From: chxuan <787280310@qq.com> Date: Sun, 22 Apr 2018 14:57:04 +0800 Subject: [PATCH] update --- .vimrc | 119 +++++++++++++++++++-------------------------------- README.md | 7 +-- install.sh | 30 ++++++------- uninstall.sh | 2 - 4 files changed, 59 insertions(+), 99 deletions(-) diff --git a/.vimrc b/.vimrc index ad0f1a70..25acf6ec 100644 --- a/.vimrc +++ b/.vimrc @@ -27,8 +27,6 @@ set nocompatible set noeb " 告诉我们文件的哪一行被改变过 set report=0 -" 可以在buffer的任何地方使用鼠标 -" set mouse=a set selection=exclusive set selectmode=mouse,key @@ -168,80 +166,48 @@ set encoding=utf8 set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" 新建文件设置 +" 插件列表 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -autocmd BufNewFile *.cpp,*.cc,*.c,*.hpp,*.h,*.sh,*.py exec ":call SetTitle()" -func SetTitle() - if expand("%:e") == 'sh' - call setline(1,"\#!/bin/bash") - call append(line("."), "") - elseif expand("%:e") == 'py' - call setline(1,"#!/usr/bin/env python") - call append(line("."),"# coding=utf-8") - call append(line(".")+1, "") - elseif expand("%:e") == 'cpp' - call setline(1,"#include ") - call append(line("."), "") - elseif expand("%:e") == 'cc' - call setline(1,"#include ") - call append(line("."), "") - elseif expand("%:e") == 'c' - call setline(1,"#include ") - call append(line("."), "") - elseif expand("%:e") == 'h' - call setline(1, "#pragma once") - elseif expand("%:e") == 'hpp' - call setline(1, "#pragma once") - endif -endfunc -autocmd BufNewFile * normal G - -" Vundle -filetype off - -set rtp+=~/.vim/bundle/Vundle.vim -call vundle#begin() -" vundle 管理的插件列表必须位于vundle#begin()和vundle#end()之间 -Plugin 'VundleVim/Vundle.vim' -Plugin 'L9' -Plugin 'chxuan/change-colorscheme' -Plugin 'Yggdroot/indentLine' -Plugin 'easymotion/vim-easymotion' -Plugin 'haya14busa/incsearch.vim' -Plugin 'wsdjeg/FlyGrep.vim' -Plugin 'iamcco/mathjax-support-for-mkdp' -Plugin 'iamcco/markdown-preview.vim' -Plugin 'jiangmiao/auto-pairs' -Plugin 'scrooloose/nerdtree' -Plugin 'tiagofumo/vim-nerdtree-syntax-highlight' -Plugin 'Xuyuanp/nerdtree-git-plugin' -Plugin 'rstacruz/sparkup', {'rtp': 'vim/'} -Plugin 'rkulla/pydiction' -Plugin 'Valloric/MatchTagAlways' -Plugin 'Valloric/YouCompleteMe' -Plugin 'docunext/closetag.vim' -Plugin 'godlygeek/tabular' -Plugin 'tpope/vim-fugitive' -Plugin 'tpope/vim-surround' -Plugin 'tpope/vim-commentary' -Plugin 'tpope/vim-repeat' -Plugin 'tpope/vim-endwise' -Plugin 'ctrlpvim/ctrlp.vim' -Plugin 'majutsushi/tagbar' -Plugin 'octol/vim-cpp-enhanced-highlight' -Plugin 'vim-airline/vim-airline' -Plugin 'vim-airline/vim-airline-themes' -Plugin 'vim-scripts/a.vim' -Plugin 'vim-scripts/DoxygenToolkit.vim' -Plugin 'vim-scripts/txt.vim' -Plugin 'ryanoasis/vim-devicons' -Plugin 'gorodinskiy/vim-coloresque' -Plugin 'will133/vim-dirdiff' -Plugin 'mhinz/vim-startify' -Plugin 'junegunn/vim-slash' - -call vundle#end() -filetype plugin indent on +call plug#begin('~/.vim/plugged') + +Plug 'vim-scripts/L9' +Plug 'chxuan/change-colorscheme' +Plug 'Yggdroot/indentLine' +Plug 'easymotion/vim-easymotion' +Plug 'haya14busa/incsearch.vim' +Plug 'wsdjeg/FlyGrep.vim' +Plug 'iamcco/mathjax-support-for-mkdp' +Plug 'iamcco/markdown-preview.vim' +Plug 'jiangmiao/auto-pairs' +Plug 'scrooloose/nerdtree' +Plug 'tiagofumo/vim-nerdtree-syntax-highlight' +Plug 'Xuyuanp/nerdtree-git-plugin' +Plug 'rstacruz/sparkup', {'rtp': 'vim/'} +Plug 'rkulla/pydiction' +Plug 'Valloric/MatchTagAlways' +Plug 'Valloric/YouCompleteMe' +Plug 'docunext/closetag.vim' +Plug 'godlygeek/tabular' +Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-surround' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-repeat' +Plug 'tpope/vim-endwise' +Plug 'ctrlpvim/ctrlp.vim' +Plug 'majutsushi/tagbar' +Plug 'octol/vim-cpp-enhanced-highlight' +Plug 'vim-airline/vim-airline' +Plug 'vim-airline/vim-airline-themes' +Plug 'vim-scripts/a.vim' +Plug 'vim-scripts/DoxygenToolkit.vim' +Plug 'vim-scripts/txt.vim' +Plug 'ryanoasis/vim-devicons' +Plug 'gorodinskiy/vim-coloresque' +Plug 'will133/vim-dirdiff' +Plug 'mhinz/vim-startify' +Plug 'junegunn/vim-slash' + +call plug#end() " load vim default plugin runtime macros/matchit.vim @@ -324,8 +290,9 @@ imap t :TagbarToggle " colorscheme set background=dark let g:solarized_termcolors=256 +let g:sorlized_termtrans=1 colorscheme solarized -"colorscheme monokai +" colorscheme monokai " cpp_class_scope_highlight let g:cpp_class_scope_highlight = 1 diff --git a/README.md b/README.md index 1cdcc1f3..c63e2585 100644 --- a/README.md +++ b/README.md @@ -71,7 +71,7 @@ An automatic configuration program for vim | 插件 | 说明 | | ------- | ----- | -| [Vundle][4] | 基于Git仓库的插件管理软件 | +| [vim-plug][4] | 比[Vundle][54]下载更快的插件管理软件 | | [YouCompleteMe][5] | 史上最强大的基于语义的自动补全插件,支持C/C++、C#、Python、PHP等语言 | | [NerdTree][6] | 显示树型目录结构 | | [Airline][8] | 可以取代[powerline][9]的状态栏美化插件 | @@ -142,7 +142,7 @@ Q & A - **`安装vimplus会经常失败,安装了几次都不成功!!!`** - vimplus安装时需要访问外国网站,由于网络原因,可能会失败,安装成功也要1个多小时,ycm插件有200M左右,下载比较耗时,这里有下载好的[YouCompleteMe.tar.gz][37]文件,下载后解压到~/.vim/bundle/目录,并进入YouCompleteMe目录linux用户执行`sudo ./install.py --clang-completer`, mac用户执行`./install.py --clang-completer`即可安装。 + vimplus安装时需要访问外国网站,由于网络原因,可能会失败,安装成功也要1个多小时,ycm插件有200M左右,下载比较耗时,这里有下载好的[YouCompleteMe.tar.gz][37]文件,下载后解压到~/.vim/plugged/目录,并进入YouCompleteMe目录linux用户执行`sudo ./install.py --clang-completer`, mac用户执行`./install.py --clang-completer`即可安装。 - **`使用第三方库时怎么让ycm补全第三方库API?`** @@ -215,7 +215,7 @@ Q & A [1]: https://raw.githubusercontent.com/chxuan/vimplus/master/screenshots/vimplus-logo.png [2]: https://raw.githubusercontent.com/chxuan/vimplus/master/screenshots/main.png [3]: https://brew.sh/ - [4]: https://github.com/VundleVim/Vundle.vim + [4]: https://github.com/junegunn/vim-plug [5]: https://github.com/Valloric/YouCompleteMe [6]: https://github.com/scrooloose/nerdtree [8]: https://github.com/vim-airline/vim-airline @@ -264,3 +264,4 @@ Q & A [51]: https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DejaVuSansMono [52]: https://github.com/tiagofumo/vim-nerdtree-syntax-highlight [53]: https://github.com/Xuyuanp/nerdtree-git-plugin + [54]: https://github.com/VundleVim/Vundle.vim diff --git a/install.sh b/install.sh index 53ce1ef2..c939e78d 100755 --- a/install.sh +++ b/install.sh @@ -61,19 +61,19 @@ function compile_vim() # 安装mac平台必要软件 function install_prepare_software_on_mac() { - brew install vim gcc cmake ctags-exuberant + brew install vim gcc cmake ctags-exuberant curl } # 安装centos发行版必要软件 function install_prepare_software_on_centos() { - sudo yum install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel + sudo yum install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel curl } # 安装ubuntu发行版必要软件 function install_prepare_software_on_ubuntu() { - sudo apt-get install -y ctags build-essential cmake python-dev python3-dev fontconfig + sudo apt-get install -y ctags build-essential cmake python-dev python3-dev fontconfig curl ubuntu_1604=`is_ubuntu1604` echo ${ubuntu_1604} @@ -89,30 +89,26 @@ function install_prepare_software_on_ubuntu() # 安装archlinux发行版必要软件 function install_prepare_software_on_archlinux() { - sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2 + sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2 curl } # 拷贝文件 function copy_files() { rm -rf ~/.vimrc - # cp .vimrc ~ ln -s ${PWD}/.vimrc ~ rm -rf ~/.vimrc.local cp ${PWD}/.vimrc.local ~ rm -rf ~/.ycm_extra_conf.py - # cp .ycm_extra_conf.py ~ ln -s ${PWD}/.ycm_extra_conf.py ~ mkdir ~/.vim rm -rf ~/.vim/plugin - # cp -R ./plugin ~/.vim ln -s ${PWD}/plugin ~/.vim rm -rf ~/.vim/colors - # cp -R ./colors ~/.vim ln -s ${PWD}/colors ~/.vim } @@ -142,29 +138,29 @@ function install_fonts_on_linux() cp ./fonts/10-powerline-symbols.conf ~/.config/fontconfig/conf.d } -# 克隆插件管理软件Vundle -function clone_vundle() +# 下载插件管理软件vim-plug +function download_vim_plug() { - git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim + curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim } # 安装vim插件 function install_vim_plugin() { - vim -c "PluginInstall" -c "q" -c "q" + vim -c "PlugInstall" -c "q" -c "q" } # 在mac平台编译ycm插件 function compile_ycm_on_mac() { - cd ~/.vim/bundle/YouCompleteMe + cd ~/.vim/plugged/YouCompleteMe ./install.py --clang-completer } # 在linux平台编译ycm插件 function compile_ycm_on_linux() { - cd ~/.vim/bundle/YouCompleteMe + cd ~/.vim/plugged/YouCompleteMe sudo ./install.py --clang-completer } @@ -195,10 +191,8 @@ function chown_dir() current_user=${who_is%% *} sudo chown -R ${current_user}:${current_user} ~/.vim sudo chown -R ${current_user}:${current_user} ~/.cache - # sudo chown ${current_user}:${current_user} ~/.vimrc sudo chown ${current_user}:${current_user} ~/.vimrc.local sudo chown ${current_user}:${current_user} ~/.viminfo - # sudo chown ${current_user}:${current_user} ~/.ycm_extra_conf.py } # 在mac平台安装vimplus @@ -207,7 +201,7 @@ function install_vimplus_on_mac() install_prepare_software_on_mac copy_files install_fonts_on_mac - clone_vundle + download_vim_plug install_vim_plugin compile_ycm_on_mac print_logo @@ -217,7 +211,7 @@ function begin_install_vimplus() { copy_files install_fonts_on_linux - clone_vundle + download_vim_plug install_vim_plugin compile_ycm_on_linux chown_dir diff --git a/uninstall.sh b/uninstall.sh index 694098c6..e0081bdb 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,7 +1,5 @@ #!/bin/bash -sudo rm -rf ~/.vimrc.local -sudo rm -rf ~/.vimrc sudo rm -rf ~/.vim echo "Done!"