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
- vim-commentary
- vim-repeat
- vim-endwise
- tabular
- vim-dirdiff
- vim-coloresque
- incsearch.vim
- vim-startify
- 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
- vim-commentary
- vim-repeat
- vim-endwise
- tabular
- vim-dirdiff
- vim-coloresque
- incsearch.vim
- vim-startify
- 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
<, + u>
- Go to definition
<, + i>
- Open the include file
<, + o>
- Buffer switch
<Ctrl + P/Ctrl + N>
- Cursor position switch
<Ctrl + O/Ctrl + I>
- Fuzzy Find File
<Ctrl + f>
- Surround
<ys{motion or text-object}{char}/cs{orig_char}{dest_char}/ds{char}>
- Comment code
<gcc/gcap/gc/,ca/,cA>
- DirDiff
:DirDiff <dir1> <dir2>
- Repeat
.
- 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.
Surround a vim text object with a pair of symmetrical chars. We can also remove or change the ones already there.
An extremely easy tool to toggle commentary in lines and visual selections. We only need to enter a mapping and a movement to do the action, as simple as that.
auto-pairs provides smart auto-completion for delimiters like (), {}, [], "", '', ``.
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
.