VI operation instructions

Source: Internet
Author: User
Tags add numbers

Command description function key
0 move to the front of the column where the cursor is located [home]
$ Move to the last [end] of the column where the cursor is located
[CTRL] [d] half a page [Pagedown]
[CTRL] [f] to the next page
[CTRL] [u] up half page
[CTRL] [B] [Pageup]

Instructions
H move to the first column of the window
M moves to the middle column of the window
L move to the last column of the window
B Move to the first letter of the next word
W: What is the value of the transferred shard? Nbsp;
E. Move to the last letter of the next word.
^ Move the first non-blank character to the column where the cursor is located

Instructions
N-Minus signs move to the first non-blank character in the previous column plus a number can be specified to move to the N column above
N + plus signs move to the first non-blank character in the next column plus a number can be specified to move to the following n columns
Ng directly uses the number N plus the capital G to move to column N
Instructions
FX
Move to the right to x characters
Move FX to the left to X characters
TX to the right before X
TX moves to the left before X characters
; Used with F & T, repeat once
, Used in combination with F & T, repeat once in the opposite direction
/Move the string to the right to a place with a string
? Move string to the left to a place with a string
N combination /&? Use, repeat once
N combination /&? Used, repeated in the opposite direction

Instructions
N (
Move the left parenthesis to the beginning of the sentence. The sentence is preceded by a number and can be specified to move n sentences forward! .? Three symbols to define
N) You can move the brackets to the beginning of the next sentence and add numbers to move n sentences to the end! .? Three symbols to define
N {move the left arc to the beginning of a paragraph. The Section is defined by a blank column between paragraphs.
N} You can move n paragraphs forward, right arc, to the beginning of the next paragraph, and add a number to the beginning of the next paragraph. You can move n paragraphs backward, which is defined by the blank columns between paragraphs.

(3) More editing commands
These editing commands are very flexible and basically consist of commands and scopes. For example, what is the best practice in DW? The combination of nbsp; D and range W indicates that a word D (elete) W (ORD) is deleted ).
The command list is as follows:
D. Delete)
Y replication (Yank)
P placement (Put)
C Change)
The range can be:
E? BR> W cursor position to the first letter of the next word
B. Place the cursor on the first letter of the last word.
$ Move the cursor to the last letter in the column
0 cursor position to the first letter in the column
) Place the cursor to the first letter in the next sentence.
(The cursor is located at the first letter in the sentence.
} Move the cursor to the last letter of the paragraph
{Place the cursor in the first letter of the paragraph
To be honest, it is a little artistic to combine these commands to edit files. In any case, they provide more text editing capabilities. It is worth noting that the deletion and replication will put the content within the specified range in the temporary storage area, and then the instruction P can be used to paste it to other places, this is how VI processes copying and moving segments.
Some VI versions, such as Elvis for Linux, can greatly simplify this instruction. If you take a look at these editing commands, you will find that the problem is actually a bit complicated by the fixed range method. In fact, there are only four commands. Command V is very easy to use. As long as you press the V key, the position of the cursor will be reversed. Then, you can move the cursor to set the range, and then directly edit the command. For the entire column operation, VI also provides more convenient editing instructions. As mentioned above, the command DD for deleting the entire text column is one of them. CC can modify the entire text column, while YY is to copy the entire text column; command D deletes all text from the cursor until the end of the column.
(4) file operation commands
File Operation commands start with:, which is a little different from editing commands.
: Q end editing (quit)
: Q! You must discard edited files without archiving them.
: W: Save the file (write) and add the file name to be archived.
: WQ indicates that the archive is removed.
ZZ functions are the same as: WQ.
Same as: WQ

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.