VIM series: position jump and block mode

Source: Internet
Author: User
VIM uses the series: position jump and block mode brackets to jump to parentheses: Jump to the bottom of a sentence, the sentence ends with a full stop or blank line, the ending in English is .. (Left parentheses) move to the beginning of the sentence) (left parentheses) move to the beginning of the next sentence... news & nbsp; | & nbsp VIM series: position jump and block mode parentheses jump to parentheses jump: Jump to the bottom of the sentence, the sentence ends with a full stop or empty line, the English ending is ". ". (Left parentheses) move to the beginning of the sentence) (left parentheses) move to the beginning of the next sentence brackets jump: Jump to the beginning or end of the function. [[Jump to the starting braces of the previous function] jump to the starting braces of the next function [] to the ending braces of the previous function] [jump to the ending braces of the next function: jump to the beginning of the paragraph, the paragraph is divided by blank lines {(left braces) jump to the beginning of the previous paragraph} (right braces) jump to the beginning of the next paragraph brackets match in the code manual work, it is always not that easy to take into account all the problems, especially small details, such as matching of parentheses. When reading other people's code, quickly locating matching parentheses is also a shortcut to quickly grasp the logic. Previously, I moved all rows and manually found matching brackets until one day I got enough of this inefficient operation method and found the shortcut symbol: %. % enables the cursor to jump from the current bracket to the matching Bracket. it is valid for both the curly brackets and the parentheses, it is a necessary killer used to check whether brackets are correct. you don't have to rush to find the wrong brackets any more. In the above various jump modes, there are not many jump methods in the project by marking a position. I also used it several times in recent days. But sometimes, in a long article, it is a good and efficient method to frequently locate special locations. Mark the position of the cursor in the File: m , Char is any letter in a-z, for example, m a jump to the Mark position :' Char is the identifier defined above. for example, 'A is called back to the previous position: ''. it is enclosed by two single quotes. Note that it is not a double quotation mark. A tag or a bookmarks will always exist unless the tagged rows are deleted or the same bookmarks are used later. Block mode the block mode refers to the VISUAL mode in VIM. In this mode, you can select, copy, cut, delete, and paste text blocks, it is more similar to the mouse text editing operation in windows. There are two slightly different VISUAL modes: VISUAL mode in NORMAL mode press the letter v key to enter, this is the general text BLOCK editing mode. in visual block mode, press Ctrl + v in NORMAL mode. this is the vertical text box editing mode, you can press Esc to return to NORMAL mode. In VISUAL mode, you can move the cursor to select a text block in the direction of behavior. VIM will highlight the selected text, and then you can use common VIM editing commands, such as y, d, p,> and so on. In visual block mode, you can move the cursor to select a vertical file BLOCK, just as in windows, you can press and hold the Alt key to select text with the mouse, you can only select text in the rectangle with the cursor starting point and ending point diagonal. There is a practical operation in these two VISUAL modes, that is, to align the indentation of the code segment. After entering VISUAL mode, select the code range that needs to be performed, and press the = key to OK, so that the selected code is automatically indented and aligned properly.
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.