As the saying goes, "to do good things, you must first sharpen the tool." Good development tools can help us greatly improve development efficiency. I have been using Vim to write c ++ in Linux for some time. Here I want to share some of the vim plug-ins I am using with you.
1. Alternate (http://www.vim.org/scripts/script.php? Script_id = 31)
In the corresponding header file andCodeFast File Switching
Installation:
(1) download a. Vim ~ /. Vim/plugindirectory, alternate.txt ~ /. Vim/doc directory
(2) Enter vim and execute helptags ~ /. Vim/doc/(note: the built-in Vim of ubuntu8.10 does not support the helptags command. You need to re-run sudo apt-Get install Vim)
Common commands:
(1): A switches between. h and. cpp files.
(2): As Vertical Split. h and. cpp files
(3): Av horizontal splitting. h and. cpp files
(4): At opens the corresponding. h or. cpp file in the new tab.
2. omnicppcomplete (http://www.vim.org/scripts/script.php? Script_id = 1520)
Auto-completion
Installation:
(1) download the latest omnicppcomplete ZIP file ~ /. Vim directory
(2) Enter vim and execute helptags ~ /. Vim/doc/
(3) then execute: H omnicppcomplete. Refer to the steps in installation to continue the installation.
(A) In ~ /Add: Set nocp and filetype plugin on to the vimrc file.
(B) In ~ /. Add a line in the vimrc file: Map <C-F12> :! Ctags-r -- C ++-kinds = + p -- fields = + IAS -- extra = + q. <CR>. In this way, you only need to press Ctrl + F12 in VIM to generate all C/C ++ in the current directory and subdirectory.Program(Generate a file named tags under the current directory)
(C) omnicppcomplete will automatically search for the tags files in the current directory. If you want to find the tags files in other directories (such as/opt/ace_wrappers/tags), you can ~ /Add to the vimrc File
Set tags + =/opt/ace_wrappers/tags
Common commands:
(1) When you enter. Or-> or <C-X> <C-O>, possible completion options are automatically displayed (you can choose from the up and down arrows)
(2) Input <C-N> auto-completion
3. ctags
Previously, omnicppcomplete used ctags. In fact, ctags has many functions. The most convenient function is to position the cursor in a variable or function and press Ctrl +] So that Vim can directly jump to the source file defined by this variable or function, CTRL + T is the inverse operation of Ctrl +]. You can return to the original place. We can continue to press Ctrl +] n times to find variables or functions, then press Ctrl + t n times to return the start point.
4. supretab (http://www.vim.org/scripts/script.php? Script_id = 1643)
Press the tab key to complete the insert completion (: Help ins-completion), which is used with omnicppcomplete for better results.
Install: Download supertab. Vim ~ /. Vim/plugin directory
5. csupport (http://www.vim.org/scripts/script.php? Script_id = 213)
This plug-in is not very familiar with the use, and the overall feeling is very good and powerful, a lot of functions need to be well explored
Installation:
(1) download cvim.zip ~ /. Vim directory, unzip
(2) read readme. csupport and the modifications to be made mainly include
(A) Modify C-support/templates
(B) modify the code style in the C. *. template file under the C-support/templates directory
(C) Modify ~ /. Vimrc file, add filetype plugin on
(D) A) Enter vim and execute helptags ~ /. Vim/doc/
(3): H csupport-vim-usage for help