I usually use vim to write a C++ program, so in order to allow me to write C++ more enjoyable, I made some vim automatically configured, the following I will be a presentation of my vimplus.
This figure is below a real shot after I configured vim.
git clone https://github.com/chxuan/vimplus.git
cd ./vimplus
sudo ./install.sh
Run the install.sh
script will automatically install and configure vim, installation takes about 40 minutes, mainly download compiler Valloric/YouCompleteMe time-consuming, please wait until the installation is complete ^ _ ^,if the installation fails, please see Warning.
The installation script will automatically install some software below:
- vim
- g++
- ctags
- cmake
- python2
- python3
and some plugins below:
- Vundle
- YouCompleteMe
- NerdTree
- nerdcommenter
- Airline
- auto-pairs
- DoxygenToolkit
- ctrlp
- tagbar
- vim-devicons
- vim-surround
- tabular
- vim-coloresque
- change-colorscheme(I am the author)
- etc...
git clone https://github.com/chxuan/vimplus.git
cd ./vimplus
sudo ./install.sh
Run the install.sh
script will automatically install and configure vim, installation takes about 40 minutes, mainly download compiler Valloric/YouCompleteMe time-consuming, please wait until the installation is complete ^ _ ^,if the installation fails, please see Warning.
The installation script will automatically install some software below:
- vim
- g++
- ctags
- cmake
- python2
- python3
and some plugins below:
- Vundle
- YouCompleteMe
- NerdTree
- nerdcommenter
- Airline
- auto-pairs
- DoxygenToolkit
- ctrlp
- tagbar
- vim-devicons
- vim-surround
- tabular
- vim-coloresque
- change-colorscheme(I am the author)
- etc...
Run the install.sh
script after the installation is complete, HOME
directory will exist .ycm_extra_conf.py and .vimrc
, the file is YCM implement C++ and other languages syntax completion function profile, I would put a general in the HOME
directory, then copy each project
a .ycm_extra_conf.py,don't just copy/paste that file somewhere and expect things to magically work; your project needs different flags. Hint: just replace the strings in the flags
variable with compilation flags necessary for your project. That should be enough for 99% of projects.
- In order to use vim-devicons, you have to set font, if you don't have guifont set and are not running gvim you will need to set the terminal font(you have to set this font:
Droid Sans Mono for Powerline Nerd Font Complete
).
- Directory tree
<F3>
- Display functions, global variables, macro definitions
<F4>
- Display static code analysis
<F5>
- .h .cpp file quickly switch
<F2>
- Go to declaration
<f + u>
- Go to definition
<f + i>
- Open the include file
<f + o>
- Buffer switch
<Ctrl + P/Ctrl + N>
- Cursor position switch
<Ctrl + O/Ctrl + I>
- Fuzzy Find File
<Ctrl + f>
- Change the colorscheme
<F10/F9>
YouCompleteMe plugin provides syntax completion function, and YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for Vim.
ctrlp plugin provides full path fuzzy file, buffer, mru, tag, ... finder for Vim.
Lean & mean status/tabline for vim that's light as air.
change-colorscheme plugin provides quick change theme function.
- If poor network conditions may fail to install, basically Valloric/YouCompleteMe installation fails, after a failed installation will need to
rm -rf ~/.vim/bundle/YouCompleteMe
, and then re-execute theinstall.sh
can be re-installed, the program will automatically install the plug-in installation fails,or I have YouCompleteMe.tar.gz,download it and thentar -xvf YouCompleteMe.tar.gz -C ~/.vim/bundle/
,thencd ~/.vim/bundle/YouCompleteMe
and runpython ./install.py --clang-completer
. - In
ubuntu16.04LTS
installation may fail(Valloric/YouCompleteMe installation fails), because vim default support for plug python3 compiled, after a failed installation, manuallycd ~/.vim/bundle/YouCompleteMe
, then runpython3 ./install.py --clang-completer
.