超级强大的vim配置(vimplus),,超级强大的vim配置


超级强大的vim配置(vimplus)

===============================================



一、概述

-----


接触vim到现在也有几年了,但是之前用vim都是在网上找别人配置好了的vim,但是别人配置的始终都不能够满足自己的需求(自己需要有强大的C/C++代码提示补全功能、头文件/源文件切换、静态代码分析等功能),所以最近自己有时间,自己归纳了一些vim的插件,然后做成一键安装程序,供有相同需求的vimer们参考,github地址:https://github.com/chxuan/vimplus,如果觉得可以请start哦,谢谢^ _ ^,学习vim的一些高级命令我推存看《vim实用技巧》。


二、屏幕截图

------------

该图是我配置过后vim的真实截图。

![enter image description here](https://raw.githubusercontent.com/chxuan/vimplus/master/screenshot/screenshot.png)


三、安装

------------


### Ubuntu安装


git clone https://github.com/chxuan/vimplus.git

cd ./vimplus

sudo ./install.sh


运行 `install.sh` 一键安装脚本将会自动对vim进行配置, 安装大约花费40分钟左右(主要是下载[Valloric/YouCompleteMe][1]花费时间比较多), 请耐心等待直到安装完成 ^ _ ^, **如果安装失败**, 请看 [注意事项](#注意事项)。


该安装脚本将自动安装一些软件:

- vim

- g++

- ctags

- cmake

- python2

- python3


还有一些插件:


- [Vundle][2]

- [YouCompleteMe][3]

- [NerdTree][4]

- [nerdcommenter][5]

- [Airline][6]

- [taglist][7]

- [auto-pairs][8]

- [DoxygenToolkit][9]

- [ctrlp][10]

- [tagbar][11]

- [change-colorscheme][12](我是作者^ _ ^)

- etc...


### Centos安装


git clone https://github.com/chxuan/vimplus.git

cd ./vimplus

sudo ./install.sh


运行 `install.sh` 一键安装脚本将会自动对vim进行配置, 安装大约花费40分钟左右(主要是下载[Valloric/YouCompleteMe][13]花费时间比较多), 请耐心等待直到安装完成 ^ _ ^, **如果安装失败**, 请看 [注意事项](#注意事项)。


该安装脚本将自动安装一些软件:

- vim

- g++

- ctags

- cmake

- python2

- python3


还有一些插件:


- [Vundle][14]

- [YouCompleteMe][15]

- [NerdTree][16]

- [nerdcommenter][17]

- [Airline][18]

- [taglist][19]

- [auto-pairs][20]

- [DoxygenToolkit][21]

- [ctrlp][22]

- [tagbar][23]

- [change-colorscheme][24](我是作者^ _ ^)

- etc...


四、配置ycm(可选项)

------------


运行 `install.sh` 脚本后, `HOME`目录将存在 [.ycm_extra_conf.py][25] 和 `.vimrc`文件, [.ycm_extra_conf.py][25]文件是实现C++语法补全功能的配置文件, 我一般将该文件放到 `HOME` 目录, 然后 `每一个项目` 一个 [.ycm_extra_conf.py][26], 只需要更改该配置文件里面的flag变量即可实现相关头文件的语法补全功能。


五、功能

------------


### 语法补全


[YouCompleteMe][27] 该插件是C++语法补全插件,该插件通过clang编译器对C++语法进行语义分析来实现语法补全的,速度比ctag用正则表达式(猜)来进行语法补全快很多.

![此处输入图片的描述][28]


### 快速改变主题

[change-colorscheme][29] 该插件提供了快速改变主题的功能

![此处输入图片的描述][30]


六、快捷键

------------


- 显示目录树 `<F3>`

- 显示函数、宏定义、全局变量等 `<F4>`

- 显示静态语法分析结果 `<F5>`

- .h .cpp 文件快速切换 `<F2>`

- 转到定义 `<f + u>`

- 转到实现 `<f + i>`

- 打开包含(include)文件 `<f + o>`

- 缓冲区(buffer)快速切换 `<Ctrl + P/Ctrl + N>`

- 光标位置切换 `<Ctrl + O/Ctrl + I>`

- 模糊查找文件 `<Ctrl + f>`

- 快速改变主题 `<F11/F12>`


### <span id="注意事项">**注意事项**</span>

------------


1. 如果网络条件不好可能导致程序安装失败, 基本上是 [Valloric/YouCompleteMe][31] 安装失败, 当安装失败后需要执行 `rm -rf ~/.vim/bundle/YouCompleteMe`命令, 然后再执行 `install.sh` 进行重新安装,重新执行脚本程序后将自动安装之前安装失败的插件, **或者我有** [YouCompleteMe.tar.gz][32]压缩文件,下载并执行 `tar -xvf YouCompleteMe.tar.gz -C ~/.vim/bundle/`命令, 然后再执行 `cd ~/.vim/bundle/YouCompleteMe` 和 `python ./install.py --clang-completer`即可安装完成。

2. 如果你使用的是 `ubuntu16.04LTS` 进行安装vimplus,也可能安装失败([Valloric/YouCompleteMe][33] 安装失败), **因为vim默认支持python3进行编译的插件**, 当安装失败后请执行 `cd ~/.vim/bundle/YouCompleteMe` 和 `python3 ./install.py --clang-completer`命令即可安装完成。



[1]: https://github.com/Valloric/YouCompleteMe

[2]: https://github.com/VundleVim/Vundle.vim

[3]: https://github.com/Valloric/YouCompleteMe

[4]: https://github.com/scrooloose/nerdtree

[5]: https://github.com/scrooloose/nerdcommenter

[6]: https://github.com/vim-airline/vim-airline

[7]: https://github.com/vim-scripts/taglist.vim

[8]: https://github.com/jiangmiao/auto-pairs

[9]: https://github.com/vim-scripts/DoxygenToolkit.vim

[10]: https://github.com/kien/ctrlp.vim

[11]: https://github.com/majutsushi/tagbar

[12]: https://github.com/chxuan/change-colorscheme

[13]: https://github.com/Valloric/YouCompleteMe

[14]: https://github.com/VundleVim/Vundle.vim

[15]: https://github.com/Valloric/YouCompleteMe

[16]: https://github.com/scrooloose/nerdtree

[17]: https://github.com/scrooloose/nerdcommenter

[18]: https://github.com/vim-airline/vim-airline

[19]: https://github.com/vim-scripts/taglist.vim

[20]: https://github.com/jiangmiao/auto-pairs

[21]: https://github.com/vim-scripts/DoxygenToolkit.vim

[22]: https://github.com/kien/ctrlp.vim

[23]: https://github.com/majutsushi/tagbar

[24]: https://github.com/chxuan/change-colorscheme

[25]: https://github.com/chxuan/vimplus/blob/master/.ycm_extra_conf.py

[26]: https://github.com/chxuan/vimplus/blob/master/.ycm_extra_conf.py

[27]: https://github.com/VundleVim/Vundle.vim

[28]: https://camo.githubusercontent.com/1f3f922431d5363224b20e99467ff28b04e810e2/687474703a2f2f692e696d6775722e636f6d2f304f50346f6f642e676966

[29]: https://github.com/chxuan/change-colorscheme

[30]: https://raw.githubusercontent.com/chxuan/vimplus/master/screenshot/screenshot2.gif

[31]: https://github.com/Valloric/YouCompleteMe

[32]: http://pan.baidu.com/s/1kUIa1kN

[33]: https://github.com/Valloric/YouCompleteMe


超级强大的vim配置(vimplus)

评论关闭