Vim Skill Record

Source: Internet
Author: User
Tags doxygen strfind git clone


Installing pluginsA good comrade has done a relatively full set of plugins, download can be used:
mv ~/.vimrc ~/.vimrcbak
mv ~/.vim ~/.vimbak
git clone https://github.com/handy1989/vim.git
mv vim/.vimrc vim/.vim ~/


Find, replace:



: 1,%s/strfind/strreplace/gn Number of searches



: 1,%s/strfind/strreplace/g Replacement






Trace function:



CTRL +], return CTRL + T






Top and bottom viewed location:



CTRL + O last cursor position, CTRL + I next cursor stop position






Global Lookup:



Vimgrep/strfind/g *.cpp






Open, close the directory:



CTRL +n or: Nerdtree nerdtreeclose



Select from top to bottom, CTRL + O to open a file






To open a list of functions in a file:



CTRL + A If you want to install the corresponding plugin









Vim's split-screen function



Summed up, basically is ctrl+w,mac is CTRL + SHIFT + W, and then add a key letter, triggering a function.
(1) Open several files in the shell and split the screen:
vim-on file1 file2 ...
vim-on file1 file2 ...



Large O for Vertical division (vertical), small o for the horizontal split (the default horizontal), the following n means a few screens, in fact, I think not to write, by default, according to the number of files to be divided into several screens.
(2) Open a split screen in Vim:
To create a blank split screen:
: New
Open any file:
: Vsplit (: VSP) filename
: SP (split) filename
Open the current file:
Ctrl+w and S (split)
Ctrl+w and V (vsplit)



(3) Close a split screen:
: Only or Ctrl+w and O cancel other split screen, keep only the current split screen
Ctrl+w and C (Close)
Only one last split screen is available:
Ctrl+w and Q (quit)
(4) Move the cursor, that is, switch the split screen, you can also move the split screen, such as the left split screen to move to the right.
Ctrl+w and W (a variety of switching, only two sub-screen when it is more convenient)
Ctrl+w and H (h) left
Ctrl+w and J (j)
On Ctrl+w and K (k)
Ctrl+w and L (l) right
(5) The last step is to change the split-screen size operation.
Ctrl+w and < Left
Ctrl+w and > right
Ctrl+w and + On
Ctrl+w and-down
Ctrl+w and = Restore equal






Multi-line comments :


Multi-line comment and delete multiline comment in vim-------------------------------------------------------------------------------1. Multi-line Comment: A. Press CTRL + V to enter the column mode; b. Select the line to be commented at the beginning of the row; C. Press "I" to enter insert mode;
D. Then enter the comment symbol ("//", "#", etc.); E. Press the "ESC" key.
2. Delete Multiline comment: A. Press CTRL + V to enter the column mode; B. Select the annotation you want to cancel;  C. Press "X" or "D".


Quick notes:


Description:5 uses have been defined so far: 1. Quickly generate license notes, and tags can be modified; 2. Rapid generation of the author declaration framework, tags can be modified; 3. Quickly generate a comment framework for C + +, Python functions, or classes that contains elements such as: @brief, @param (generates a @param for each parameter), and @return. Both the header and footer of the label text and the comment block can be modified (so you can have your own profile, if you are literal, plus a little accomplishment);
Ignores code fragmentation in #ifdef. #endif (c + + +) blocks. When naming a block, be sure to consider its functionality. In all files, all associated blocks will be placed in a new block Dox_skip_block (or user-defined name). You need to update the predefined variable in your Doxygen configuration file with the current new block name. And you also need to set enable_preprocessing to Yes. 4. Quickly generate an annotation set (start or end), the label can be modified; using: 4.1 Note type (c/c++///or, python:# #和 #): In Vim, the default C + + comment is, but if you prefer to use//, Just add the following statement to your profile. VIMRC: Let g:doxygentoolkit_commenttype= "C + +". 4.2 License: In VIM, place the cursor in the line that will write the Doxygen permission note, and then,Execute command: doxlic. This will generate a license comment and place the cursor after the line just before. 4.3
In vim, place your cursor where you want to add Doxygen author comments.then execute the command: Doxauthor. This will generate a framework that places the cursor after the @author tag or after the frame if no variable is set for it. 4.4 Function/Class Comment: In vim, place the cursor in the line of the function head (or the function's return variable) or class.then execute the command: Dox. This generates the frame and places the cursor after the @brief label. 4.5 Ignore Code Snippets (C + + only): In Vim, if you want to ignore all code snippets in the block, similar to: #ifdef DEBUG ... #endif你只需要执行以下命令:Doxundoc (DEBUG)! Group 4.6: In Vim, execute the command: Doxblock inserts a Doxygen block in the following line.   Limitations:1. Assume that the function name (followed by the opening parenthesis) is at least the third line after the current cursor position; 2. The comment block cannot be updated again until it is written; 3. The Block delimiter (head and tail) contains only function annotations; 4. Assume that the indentation has been used; 5. The comments in the function arguments are not supported; (like void foo (int bar)) 6. Customize the output script, in the script file, set the g:doxygentoolkit_* variable in the. VIMRC: For example, in My. VIMRC contains: let g:doxygentoolkit_brieftag_pre= @Synopsis G:doxygentoolkit_paramtag_pre= "@Param" Let g:doxygentoolkit_returntag= "@Returns" Let g:doxygentoolkit_blockheader= "--------------------------------------------------------------------------" Let g:doxygentoolkit_blockfooter= "- ---------------------------------------------------------------------------"Let G:doxygentoolkit_authorname=" Mathias Lorente "Let g:doxygentoolkit_licensetag=" My own license "<--!!! Does not end with "\<enter>"  Installation Details:will Doxygentoolkit.vimCopy to ' ~/.vim/plugin ' directory

Vim Skill Record


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.