Skip to content

Commit 5f21533

Browse files
committed
update
1 parent b8941df commit 5f21533

File tree

4 files changed

+59
-99
lines changed

4 files changed

+59
-99
lines changed

.vimrc

Lines changed: 43 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ set nocompatible
2727
set noeb
2828
" 告诉我们文件的哪一行被改变过
2929
set report=0
30-
" 可以在buffer的任何地方使用鼠标
31-
" set mouse=a
3230
set selection=exclusive
3331
set selectmode=mouse,key
3432

@@ -168,80 +166,48 @@ set encoding=utf8
168166
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030
169167

170168
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
171-
" 新建文件设置
169+
" 插件列表
172170
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
173-
autocmd BufNewFile *.cpp,*.cc,*.c,*.hpp,*.h,*.sh,*.py exec ":call SetTitle()"
174-
func SetTitle()
175-
if expand("%:e") == 'sh'
176-
call setline(1,"\#!/bin/bash")
177-
call append(line("."), "")
178-
elseif expand("%:e") == 'py'
179-
call setline(1,"#!/usr/bin/env python")
180-
call append(line("."),"# coding=utf-8")
181-
call append(line(".")+1, "")
182-
elseif expand("%:e") == 'cpp'
183-
call setline(1,"#include <iostream>")
184-
call append(line("."), "")
185-
elseif expand("%:e") == 'cc'
186-
call setline(1,"#include <iostream>")
187-
call append(line("."), "")
188-
elseif expand("%:e") == 'c'
189-
call setline(1,"#include <stdio.h>")
190-
call append(line("."), "")
191-
elseif expand("%:e") == 'h'
192-
call setline(1, "#pragma once")
193-
elseif expand("%:e") == 'hpp'
194-
call setline(1, "#pragma once")
195-
endif
196-
endfunc
197-
autocmd BufNewFile * normal G
198-
199-
" Vundle
200-
filetype off
201-
202-
set rtp+=~/.vim/bundle/Vundle.vim
203-
call vundle#begin()
204-
" vundle 管理的插件列表必须位于vundle#begin()和vundle#end()之间
205-
Plugin 'VundleVim/Vundle.vim'
206-
Plugin 'L9'
207-
Plugin 'chxuan/change-colorscheme'
208-
Plugin 'Yggdroot/indentLine'
209-
Plugin 'easymotion/vim-easymotion'
210-
Plugin 'haya14busa/incsearch.vim'
211-
Plugin 'wsdjeg/FlyGrep.vim'
212-
Plugin 'iamcco/mathjax-support-for-mkdp'
213-
Plugin 'iamcco/markdown-preview.vim'
214-
Plugin 'jiangmiao/auto-pairs'
215-
Plugin 'scrooloose/nerdtree'
216-
Plugin 'tiagofumo/vim-nerdtree-syntax-highlight'
217-
Plugin 'Xuyuanp/nerdtree-git-plugin'
218-
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
219-
Plugin 'rkulla/pydiction'
220-
Plugin 'Valloric/MatchTagAlways'
221-
Plugin 'Valloric/YouCompleteMe'
222-
Plugin 'docunext/closetag.vim'
223-
Plugin 'godlygeek/tabular'
224-
Plugin 'tpope/vim-fugitive'
225-
Plugin 'tpope/vim-surround'
226-
Plugin 'tpope/vim-commentary'
227-
Plugin 'tpope/vim-repeat'
228-
Plugin 'tpope/vim-endwise'
229-
Plugin 'ctrlpvim/ctrlp.vim'
230-
Plugin 'majutsushi/tagbar'
231-
Plugin 'octol/vim-cpp-enhanced-highlight'
232-
Plugin 'vim-airline/vim-airline'
233-
Plugin 'vim-airline/vim-airline-themes'
234-
Plugin 'vim-scripts/a.vim'
235-
Plugin 'vim-scripts/DoxygenToolkit.vim'
236-
Plugin 'vim-scripts/txt.vim'
237-
Plugin 'ryanoasis/vim-devicons'
238-
Plugin 'gorodinskiy/vim-coloresque'
239-
Plugin 'will133/vim-dirdiff'
240-
Plugin 'mhinz/vim-startify'
241-
Plugin 'junegunn/vim-slash'
242-
243-
call vundle#end()
244-
filetype plugin indent on
171+
call plug#begin('~/.vim/plugged')
172+
173+
Plug 'vim-scripts/L9'
174+
Plug 'chxuan/change-colorscheme'
175+
Plug 'Yggdroot/indentLine'
176+
Plug 'easymotion/vim-easymotion'
177+
Plug 'haya14busa/incsearch.vim'
178+
Plug 'wsdjeg/FlyGrep.vim'
179+
Plug 'iamcco/mathjax-support-for-mkdp'
180+
Plug 'iamcco/markdown-preview.vim'
181+
Plug 'jiangmiao/auto-pairs'
182+
Plug 'scrooloose/nerdtree'
183+
Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
184+
Plug 'Xuyuanp/nerdtree-git-plugin'
185+
Plug 'rstacruz/sparkup', {'rtp': 'vim/'}
186+
Plug 'rkulla/pydiction'
187+
Plug 'Valloric/MatchTagAlways'
188+
Plug 'Valloric/YouCompleteMe'
189+
Plug 'docunext/closetag.vim'
190+
Plug 'godlygeek/tabular'
191+
Plug 'tpope/vim-fugitive'
192+
Plug 'tpope/vim-surround'
193+
Plug 'tpope/vim-commentary'
194+
Plug 'tpope/vim-repeat'
195+
Plug 'tpope/vim-endwise'
196+
Plug 'ctrlpvim/ctrlp.vim'
197+
Plug 'majutsushi/tagbar'
198+
Plug 'octol/vim-cpp-enhanced-highlight'
199+
Plug 'vim-airline/vim-airline'
200+
Plug 'vim-airline/vim-airline-themes'
201+
Plug 'vim-scripts/a.vim'
202+
Plug 'vim-scripts/DoxygenToolkit.vim'
203+
Plug 'vim-scripts/txt.vim'
204+
Plug 'ryanoasis/vim-devicons'
205+
Plug 'gorodinskiy/vim-coloresque'
206+
Plug 'will133/vim-dirdiff'
207+
Plug 'mhinz/vim-startify'
208+
Plug 'junegunn/vim-slash'
209+
210+
call plug#end()
245211

246212
" load vim default plugin
247213
runtime macros/matchit.vim
@@ -324,8 +290,9 @@ imap <Leader>t <ESC> :TagbarToggle<CR>
324290
" colorscheme
325291
set background=dark
326292
let g:solarized_termcolors=256
293+
let g:sorlized_termtrans=1
327294
colorscheme solarized
328-
"colorscheme monokai
295+
" colorscheme monokai
329296

330297
" cpp_class_scope_highlight
331298
let g:cpp_class_scope_highlight = 1

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ An automatic configuration program for vim
7171

7272
| 插件 | 说明 |
7373
| ------- | ----- |
74-
| [Vundle][4] | 基于Git仓库的插件管理软件 |
74+
| [vim-plug][4] | 比[Vundle][54]下载更快的插件管理软件 |
7575
| [YouCompleteMe][5] | 史上最强大的基于语义的自动补全插件,支持C/C++、C#、Python、PHP等语言 |
7676
| [NerdTree][6] | 显示树型目录结构 |
7777
| [Airline][8] | 可以取代[powerline][9]的状态栏美化插件 |
@@ -142,7 +142,7 @@ Q & A
142142

143143
- **`安装vimplus会经常失败,安装了几次都不成功!!!`**
144144

145-
vimplus安装时需要访问外国网站,由于网络原因,可能会失败,安装成功也要1个多小时,ycm插件有200M左右,下载比较耗时,这里有下载好的[YouCompleteMe.tar.gz][37]文件,下载后解压到~/.vim/bundle/目录,并进入YouCompleteMe目录linux用户执行`sudo ./install.py --clang-completer`, mac用户执行`./install.py --clang-completer`即可安装。
145+
vimplus安装时需要访问外国网站,由于网络原因,可能会失败,安装成功也要1个多小时,ycm插件有200M左右,下载比较耗时,这里有下载好的[YouCompleteMe.tar.gz][37]文件,下载后解压到~/.vim/plugged/目录,并进入YouCompleteMe目录linux用户执行`sudo ./install.py --clang-completer`, mac用户执行`./install.py --clang-completer`即可安装。
146146

147147
- **`使用第三方库时怎么让ycm补全第三方库API?`**
148148

@@ -215,7 +215,7 @@ Q & A
215215
[1]: https://raw.githubusercontent.com/chxuan/vimplus/master/screenshots/vimplus-logo.png
216216
[2]: https://raw.githubusercontent.com/chxuan/vimplus/master/screenshots/main.png
217217
[3]: https://brew.sh/
218-
[4]: https://github.com/VundleVim/Vundle.vim
218+
[4]: https://github.com/junegunn/vim-plug
219219
[5]: https://github.com/Valloric/YouCompleteMe
220220
[6]: https://github.com/scrooloose/nerdtree
221221
[8]: https://github.com/vim-airline/vim-airline
@@ -264,3 +264,4 @@ Q & A
264264
[51]: https://github.com/ryanoasis/nerd-fonts/tree/master/patched-fonts/DejaVuSansMono
265265
[52]: https://github.com/tiagofumo/vim-nerdtree-syntax-highlight
266266
[53]: https://github.com/Xuyuanp/nerdtree-git-plugin
267+
[54]: https://github.com/VundleVim/Vundle.vim

install.sh

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ function compile_vim()
6161
# 安装mac平台必要软件
6262
function install_prepare_software_on_mac()
6363
{
64-
brew install vim gcc cmake ctags-exuberant
64+
brew install vim gcc cmake ctags-exuberant curl
6565
}
6666

6767
# 安装centos发行版必要软件
6868
function install_prepare_software_on_centos()
6969
{
70-
sudo yum install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel
70+
sudo yum install -y vim ctags automake gcc gcc-c++ kernel-devel cmake python-devel python3-devel curl
7171
}
7272

7373
# 安装ubuntu发行版必要软件
7474
function install_prepare_software_on_ubuntu()
7575
{
76-
sudo apt-get install -y ctags build-essential cmake python-dev python3-dev fontconfig
76+
sudo apt-get install -y ctags build-essential cmake python-dev python3-dev fontconfig curl
7777
ubuntu_1604=`is_ubuntu1604`
7878
echo ${ubuntu_1604}
7979

@@ -89,30 +89,26 @@ function install_prepare_software_on_ubuntu()
8989
# 安装archlinux发行版必要软件
9090
function install_prepare_software_on_archlinux()
9191
{
92-
sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2
92+
sudo pacman -S --noconfirm vim ctags automake gcc cmake python3 python2 curl
9393
}
9494

9595
# 拷贝文件
9696
function copy_files()
9797
{
9898
rm -rf ~/.vimrc
99-
# cp .vimrc ~
10099
ln -s ${PWD}/.vimrc ~
101100

102101
rm -rf ~/.vimrc.local
103102
cp ${PWD}/.vimrc.local ~
104103

105104
rm -rf ~/.ycm_extra_conf.py
106-
# cp .ycm_extra_conf.py ~
107105
ln -s ${PWD}/.ycm_extra_conf.py ~
108106

109107
mkdir ~/.vim
110108
rm -rf ~/.vim/plugin
111-
# cp -R ./plugin ~/.vim
112109
ln -s ${PWD}/plugin ~/.vim
113110

114111
rm -rf ~/.vim/colors
115-
# cp -R ./colors ~/.vim
116112
ln -s ${PWD}/colors ~/.vim
117113
}
118114

@@ -142,29 +138,29 @@ function install_fonts_on_linux()
142138
cp ./fonts/10-powerline-symbols.conf ~/.config/fontconfig/conf.d
143139
}
144140

145-
# 克隆插件管理软件Vundle
146-
function clone_vundle()
141+
# 下载插件管理软件vim-plug
142+
function download_vim_plug()
147143
{
148-
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
144+
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
149145
}
150146

151147
# 安装vim插件
152148
function install_vim_plugin()
153149
{
154-
vim -c "PluginInstall" -c "q" -c "q"
150+
vim -c "PlugInstall" -c "q" -c "q"
155151
}
156152

157153
# 在mac平台编译ycm插件
158154
function compile_ycm_on_mac()
159155
{
160-
cd ~/.vim/bundle/YouCompleteMe
156+
cd ~/.vim/plugged/YouCompleteMe
161157
./install.py --clang-completer
162158
}
163159

164160
# 在linux平台编译ycm插件
165161
function compile_ycm_on_linux()
166162
{
167-
cd ~/.vim/bundle/YouCompleteMe
163+
cd ~/.vim/plugged/YouCompleteMe
168164
sudo ./install.py --clang-completer
169165
}
170166

@@ -195,10 +191,8 @@ function chown_dir()
195191
current_user=${who_is%% *}
196192
sudo chown -R ${current_user}:${current_user} ~/.vim
197193
sudo chown -R ${current_user}:${current_user} ~/.cache
198-
# sudo chown ${current_user}:${current_user} ~/.vimrc
199194
sudo chown ${current_user}:${current_user} ~/.vimrc.local
200195
sudo chown ${current_user}:${current_user} ~/.viminfo
201-
# sudo chown ${current_user}:${current_user} ~/.ycm_extra_conf.py
202196
}
203197

204198
# 在mac平台安装vimplus
@@ -207,7 +201,7 @@ function install_vimplus_on_mac()
207201
install_prepare_software_on_mac
208202
copy_files
209203
install_fonts_on_mac
210-
clone_vundle
204+
download_vim_plug
211205
install_vim_plugin
212206
compile_ycm_on_mac
213207
print_logo
@@ -217,7 +211,7 @@ function begin_install_vimplus()
217211
{
218212
copy_files
219213
install_fonts_on_linux
220-
clone_vundle
214+
download_vim_plug
221215
install_vim_plugin
222216
compile_ycm_on_linux
223217
chown_dir

uninstall.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
22

3-
sudo rm -rf ~/.vimrc.local
4-
sudo rm -rf ~/.vimrc
53
sudo rm -rf ~/.vim
64

75
echo "Done!"

0 commit comments

Comments
 (0)