Vim simple tutorial (2) Vim simple tutorial (1) complete. Quickly move the cursor www.2cto.com to start with the next word: w... vim simple tutorial (2) Vim simple tutorial (1) http://www.2cto.com/ OS /201303/193905.html lesson 2 faster editing this back will introduce some basic operational commands that were not mentioned at the previous time. Quickly move the cursor www.2cto.com to the start of the next word: w move the cursor to the start of the previous word: B is similar, 2 w indicates moving two words backward. Move to the end of a row: $ move to the beginning of a row: Move to the first non-blank character in a line: ^ (friends who are familiar with regular expressions must be familiar with $ and ^ .) Moving two rows down is naturally: 2 $ search for a character in a row from the current position to the position where x appears for the first time, and move the cursor over: fx looks forward from the current position to the position where x appears for the first time and moves the cursor over: if Fx does not find x, a pair of commands such as t and T are not moved. Similar to f and F, but it will be a character before the character found. Move the cursor to the specified row and move it to the specified row n: nG. for example, move the cursor to row 3rd: move 3G to the last row: G. show the row number. show the row number: set number. hide the row number :: set nonumber gives the row, column information where the current cursor is located: CTRL-G flip up scroll up half screen text: CTRL-U scroll down half screen text: CTRL-D delete text has been introduced before deleting a line: dd deletes the cursor from the current position to the end of the current word, and removes the trailing space. the dwW command moves the cursor to the start position of the next word, dw deletes all the characters that pass by when the cursor moves. of course, the characters at the last position when the cursor moves are not deleted. Similarly, delete three words: 3dw or d3w. In fact, the d command can be followed by any cursor moving command. for example, dfi indicates that the words are deleted from the current position until the first time I occurs. Of course, if the current line does not find I, the above command will not do anything, because the cursor does not move at this time. Repeat the last command to repeat the last command:. (a full stop) for example, if the last command is dd, then. (a full stop) is equivalent to dd. Merge the two rows to merge the current row and the next row into one row: J to replace the current character with x: rx (replace) to change the case sensitivity of the current character :~ After the case is changed, move the cursor backward. But it is moving within the row and will not go to the next row. Recording a keyboard macro operation we can record a series of operations into a macro: The q command macro name is a lowercase letter. The following is an example: suppose our file contains the following lines. Stdio. hfcntl. hunistd. hstdlib. h we want to edit it as: # include "stdio. h "# include" fcntl. h "# include" unistd. h "# include" stdlib. h "first move the cursor to the beginning of the first line. Run the following command: qa ^ I # include "$ a" jq to record a macro named. Run this macro three times later: 3 @
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.