VI Editor Complete Manual (Transfer)

xiaoxiao2021-03-06  115

VI Editor Complete Manual

Recommendation: This article is a netizen of the beginner UNIX VI editor, and the detailed command table paid after the text can be used as a reference to users who have already skilled VI, so you'd better download this article or print this article and then control practice Learn. 1. UNIX Editor Overview Editor is one of the important tools using a computer. In various operating systems, the editor is an indispensable part. In the Unix and its similar IX operating system series, a range of EX editors, including EX, EDIT, ED, and VI for various users, including EX, EDIT, ED, and VI. The editor is now rarely used, and UNIX provides them is to consider the need to meet the needs of various users, especially certain end users. Fortunately, UNIX provides a full-screen VI editor, which makes our work more relaxed. Many DOS users complain that the VI editor is not like Edit, such as Edit, because VI takes into account the needs of various users, does not use some universal editing keys (on each of the different terminals Definitions are different, and there is no such keys on some terminals). Instead, the method of switching is used, but this is just a habit, once you skilled VI, you will feel that it is also very easy. Although Vi uses a state switching method, the computer's hardware and operating system are varied, and there are few function keys on certain computers on keyboards! So don't you have some features? This problem is the same in the UNIX system, almost major computer vendors have their own UNIX systems, while VI's operating methods will also be inserted. Here we use the PC keyboard to illustrate the operation of the VI, but in the specific environment, you should pay attention to the corresponding information, this is worth noting. Second, VI Getting Started (1), enter the VI in the system prompt character (such as $, #) into the VI , VI can automatically help you load the file you want to edit or open a new file (if this file) There is no or missing file name). After entering the VI, the left side will have a wave symbol. Anyone who lists this symbol represents this column is currently empty. (2) Two modes are as described above, there are two modes: command mode and input mode. The button entered in the command mode will be processed as an instruction: if entered A, VI is considered to be inserted in the current location. In the input mode, VI processes the input button as inserted characters. Command mode Switch to the input mode Simply type the corresponding input command (such as A, a), and switch from the input mode to the instruction mode, you need to type the ESC button in the input mode, if you don't know what is now? Mode, you can press several [ESC], and the system is indicating that it is already in an instruction mode. Pay: There is an instruction of the instruction mode into the input mode: Append A: Start additional information from the position where the cursor is located, the data after the cursor moves backwards with the new information. A: Add information from the last place where the cursor is located. Insert i: Inserting data from the position where the cursor is located, the data after the cursor moves backwards with the new data. I: Insert the information from the first non-empty white font in the column where the cursor is located. Start (OPEN) O: Add a column below the cursor and enter the input mode. O: Add a column above the column where the cursor is located and enters the input mode. (3) Exit VI In command mode: Q,: Q!,: Wq or: x (Note: Number), will exit VI.

Where: WQ and: X is the deployment of the storage, and: q is directly exiting, and the vi will prompt you to save the file if the file already has a new change. At this time, you can use: w command to save the file. Use: Q to exit, or use: wq or: x command to exit, if you don't want to save after changing files, you need to use: Q! Command, this command will not save the file directly to exit the VI. (4) Basic editing with the function keys on the typical keyboard, like the arrow keys, [INSERT], [Delete], etc. Now, you should already use VI to edit files. Of course, VI also provides other many features that make the text more convenient. What is edited? It is generally considered to be new, modified, and deleted, even including blocking, copying, etc. of the text block. First introduce how the VI is deleted and modified. (Note: In the original concept of VI, the input and editing is two code. Editing is in the command mode, first using the command to move the cursor to locate the place where you want to edit, then you will be edited.) Delete Modify the command: x: Delete the character in the cursor. DD: Delete the column where the cursor is located. r: Modify the character where the cursor is located, and then the character to be corrected. R: Enter the replacement state, the new text will overwrite the original text until [ESC] is pressed back to the instruction mode. s: Delete the cursor where the cursor is located and enter the input mode. S: Delete the column where the cursor is located and enter the input mode. In fact, there is not so troublesome on the PC! Entering and editing can be done in the input mode. For example, you want to delete the character, press [Delete] directly. The insertion state and the replacement state can be used directly with [INSERT], and the editing instructions of any instruction mode are not used. However, as mentioned earlier, these instructions can be used per terminal, not just on the PC. The basic instructions of moving the cursor in the instruction mode are H, J, K, L. I want to come to you now you should also guess the direction of the PC directly using the PC, and whether it can be in the instruction mode or input mode. Many easier. Of course, the PC keyboard is also inadequate. There is a good use of instructions u to recover the deleted text, and the U command can restore all changes in the column where the cursor is located. This is the same as the [UNDO] button on some computers. Third, Attachment: VI Detailed Instruction Table (1), Basic Editing Instruction: New (APPEND) A: From the position where the cursor is located, the cursor after the cursor moves backwards with the new information. A: Add information from the last place where the cursor is located. Insert i: Inserting data from the position where the cursor is located, the data after the cursor moves backwards with the new data. I: Insert the information from the first non-empty white font in the column where the cursor is located. Start (OPEN) O: Add a column below the cursor and enter the input mode. O: Add a column above the column where the cursor is located and enters the input mode. x: Delete the character in the cursor. DD: Delete the column where the cursor is located. r: Modify the character where the cursor is located, and then the character to be corrected. R: Enter the replacement state, the new text will overwrite the original text until [ESC] is pressed back to the instruction mode. s: Delete the cursor where the cursor is located and enter the input mode. S: Delete the column where the cursor is located and enter the input mode. (2), cursor movement instructions: Since many editing work is positioned by cursors, VI provides many way of mobile cursor, which we are listed in a few simple tables (these of course are instructions in instruction mode): instruction 

  function key

0

Move to the front of the column where the cursor is located

[Home] 

$ 

Move to the last side of the column where the cursor is located

[End]

[Ctrl] [D]

Next half page

[PageDown]

[Ctrl] [f]

Next page

[Ctrl] [u]

Up to the upper page

[Ctrl] [b]

Upwards

[Pageup]

instruction

Description

Hide

Move to the first column of the window

M

Move to the intermediate column of the window

L

Move to the last column of the window

b

First letter moved to the next word

w

The first letter to move to the previous word

e

Move last letter to the next word

^

Mobile to the first non-empty white character in the column where the cursor is located

instruction

Description

N-

The minus movement to the first non-empty-white font in the previous column plus numbers can be specified to move to the above N columns

N

The first non-empty-white font before the plus moved to the next column plus numbers can be specified to move to the following N columns.

ng

Directly use Number N plus uppercase G move to Nth column

instruction

Description

FX moves to the right to X-RMB

FX

Move left to X-character onto

TX

Move right away to X-character before

TX

Move left to X-character before

;

With F & T, repeat once

, 

With F & T, repeat in the opposite direction

/ String

Move right away to a String place

String

Move left to the place where String

n 

Team / &? Use, repeat

N 

With / &? Use, repeat in the opposite direction

instruction

Description

 note

n (the foresight sentence of the left bracket moving to the sentence is to add numbers with numbers to specify N sentences to move n sentences

!.? Three symbols to define

n) 

The first front of the right bracket moves to the next sentence plus the number can be specified to move N sentences behind

!.? Three symbols to define

n {

The front left bracket moves to the front of the paragraph

The paragraph is defined in a blank column between paragraphs.

N}

The front plus the number can specify the forward moving n paragraph right projection to the top of the next paragraph, plus the number can specify the backward movement N sections.

The paragraph is defined in a blank column between paragraphs.

转载请注明原文地址:https://www.9cbs.com/read-125048.html

New Post(0)