VI instructions

xiaoxiao2021-03-06  19

VI instructions http://www.fanqiang.com (2001-06-23 19:05:00) Selected from the forever UNIX website

1. Introduction to VI VI is an extremely popular full-screen book editor in the UNIX world, almost any unix machine will provide this software. There is of course linux, and its VI is actually ELVIS (copyright issues), but they are almost. After familiar with DOS, it may feel that VI is not easy to use; there are many updated, more useful instrument editors, but not necessarily installed on each UNIX machine. . Therefore, the basic operation of learning VI is still good, so you have a heart in various machines. 2, VI Basic Concepts Unix provide a range of EX editors, including EX, EDIT, and VI. Compared to the full screen editor, it is now possible to imagine how to use EX, Edit, which has been used for DOS 3.3, which is used by EDLIN?). VI's original interest is "Visual", it is an editorial program that immediately reacts, that is, see the operation results immediately. Also because VI is a full-screen editor, it must control what the entire terminal screen is displayed. There are many kinds of terminals of the terminal, and the characteristics are not the same, so the VI is necessary to know which terminal is now used. This is set by the TERM's environment variable, set the description of the Shell used by setting the environment variable. (Unless the Unknow Terminal Type is returned, you can set it without setting.) As long as the simple execution vi can enter the VI's editing environment. There is a rough understanding of it before actual operation. VI has two modes, input mode, and instruction mode. The input mode is used to input a textuality, and the instruction mode is an operational instruction used to meet some of the arrangement files, archives, and leaving VI, and the like. When VI is executed, you will first enter the instruction mode, and any of the characters entered is considered to be instructions. 3. Entering and leaving To enter VI can type VI , VI can automatically load the file you want to edit or open a new file. After entering VI, the left side will have a wave symbol. Anyone who has the first symbol represents this column is currently empty. To leave the VI, you can type in command mode: Q,: The WQ instruction is the archive and then leave (pay attention to the colon). To switch to the command mode, use the [ESC] button. If you don't know what model is now, you can press [ESC] to make a beep to determine the entry instruction mode. 4, how do you enter information? Several instructions can enter the input mode: Append A starting new information from the position of the cursor, and the data after the cursor moves backwards with the new information. A starts new information from the last place where the cursor is located. Insert i starts inserting information from the front of the cursor location, the data after the cursor moves backwards with the new data. I starts inserting information from the first non-empty white font in the column of the cursor. Start (Open) 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. Perhaps the text narrative looks a bit complicated, but as long as you actually do it, you can understand these ways. It is important to be active, especially if the computer is always try and verify results. It is best to use it to use it without a fierce, and there is a halving utility. (Note: This paragraph is nonsense.

5. VI Basic Edit Mix the function keys on the typical keyboard, such as the arrow keys, [INSERT], [Delete], etc. Now you should already use VI to process text information. Of course, VI also provides many other ways to make text more convenient, interested, please continue. Let's go to the BCC before you continue. There are many labels, different hardware and operation systems. The PC is not only IBM PC and its compatibility. In fact, including keyboards, terminals, etc. often have different specifications. What does this represent? In the instrument editing software, there will be such problems, and there is no specific number of function keys on certain computers on the keyboard! 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. We can use the PC's keyboard to make a VI's operation, but still have to mention this problem. What is the editing and modification? Here we think that the new modification of the text and delete, even including the movement, replication, etc. of the text block. Here first, how to make deletion and modification of VI first. (Note: In the original concept of VI, the input and editing is two code. Editing is in the command mode, first using the instruction mobile cursor to locate the place where you want to edit, then the instruction is edited.) X Delete The cursor is located. DD Deletes the column where the cursor is located. R modifies the cursor where the cursor is located, and then the character to be corrected. R Enter the substitution state, the new information will overwrite the original information 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 enters 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, to delete a word, press [Delete] directly. The insertion state and the replacement state can be directly exchanged with [INSERT], and it is not necessary to use the editing instruction of any instruction mode. However, as mentioned earlier, these instructions can be used per terminal, not just on the PC. The basic instructions for moving cursors in the instruction mode are H, J, K, L. I want to come to you now you should also guess the direction keys that directly use 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 very good instruction u to recover the deleted information, and the U instruction can recover all changes in the column where the cursor is located. This can be the same as the [UNDO] button on some computers. 6, VI advanced applications I believe that now I should have considerable understanding of VI. Don't have any trouble for processing text. If you are interested in further simplifying the operational procedure with other features of VI, you may continue to look down.

Mobile Cursor is positioned by many editing work, so VI provides a number of mobile cursors, this is a few briefings to illustrate (these of course are instructions in instruction mode): ┌ ----- ┬ --- ---------- ┬ ----- ┐ │ Directive │ │ │ Function Key │ ├ ----- ┼ ------------- ┼ ------ -┤ │0 │ Move the most in front of the cursor listed │ [Home] │ ├ ----- ┼ ------------- ┼ ----- ┤ │ $ │ Move to The last list of the cursor listed │ [end] │ ├ ----- ┼ ------------- ┼ ----- ┤ │ [Ctrl] [D] │ next to the page │ │ ----- ┼ ------------- ┼ ----- ┤ │ [ctrl] [f] │ to the next page │ [Pagedown] │ ├ --- - ┼ ------------- ┼ ----- ┤ │ [ctrl] [u] │ to the upper page │ │ ├ ---- ┼ ------- ------ ┼ ----- ┤ │ [Ctrl] [B] │ Page 1 │ [PageUp] │ └ ----- ┴ ------------- ┴ ----- ┘ ┌ - ┬ ----------------- ┐ │ Directive │ │ - ┼ ------------- ---- ┤ │H │ Move to the first column of the window │ ├ - ┼ ---------------- ┤ │M │ Move to the intermediate column of the window │ ├- -┼ ---------------- ┤ │L │ Move to the window of the window │ ├ - ┼ ---------------- -┤ │B │ Move the first letter to the next word │ ├ - ┼ ---------------- ┤ │W │ Move to the first word Letters │ ├ - ┼ ----------------- ┤ ┤│E │ Move to the last word of the next word │ ├ - ┼ ---------------- ┤ │ ^ │ Move to the first non-empty white character │ └ - ┴ ----------------- ┘ ┌ - ┬ ------------------- ┐ │ instruction │ │ ├ - ┼ ------------------- ┤ │N- │ 减 号 移动 移动 移动 上 上 非 非 非 非 非 非 非 非 非 非 非 非 非 非Can be specified to move to above N columns │ ├ - ┼ ------------------- ┤ │N │ plus mobile to the next column first non-empty white character │ │ │ A front plus numbers can be specified to move to the following N columns │ ├ - ┼ ----------------- ┤ │NG │ Directly with Digital N plus uppercase G move To nth │ └ - ┴ ------------------- ┘ ┌ ---- ┬ --------------- ┐ │ Directive │ Description │ ├ ---- ┼ -------------- ┤ │FX │ moving to the right to X-RM │ │FX │ move left to X character上 │ ---- ┼ --------------- ┤ │TX │ go to the right to X-character before │ │TX │ move left to X-character before │ ├- --- ┼ --------------- ┤ │;

│ Combine F & T, repeat │ │ │ │ │ Comment with F & T, repeat │ ├ ---- ┼ -------------- ┤ │ / string │ Turn right String places │ │? String │ moving to left to String place │ ├ ---- ┼ -------------- ┤ │N │ Team / &? Use, repeat One │ │N │ Match / &? Use, reverse direction │ └ ---- ┴ -------------- ┘ ┌ ---- ┬ -------- ------------- ┬ ---------- ┐ │ Directive │ │ Remarks │ ├ ---- ┼ ------------ ------- ┼ ---------- ┤ │N (│ 左 括 移动 移动 移动 子 是 是│!.? Three symbols to define │ │N) │ 括 移动 移动 到 字 字 字 字 字 字 字 字 字 字 字 字 字 字----------------- ┼ ---------- ┤ │N {│ The front │ │ │ │ │ │ │ │ │ before Up number can specify the previous mobile N paragraph │ segment space default │ │N} │ 括 移动 到 下 段 前 前 字 字 字 字 字 字 字 字 字 字 字 字 字 字 字 字 字 字└ ---- ┴ ------------------- ┴ ---------- ┘ Do not try to recite these instructions, otherwise the consequences are responsible. They look more and messy, in fact, this is the obstacle to the text. Again again, actually use it as long as you can directly download these strange strange instructions without the brain, far better than the death of the death. (Note: If you really don't want to delete the information with me. In addition, this paragraph is nonsense.) 7, advanced editing instructions These editing instructions are very flexible, basically, can be made up of instructions and scope. For example, DW is composed of deleted command D and range W, and represents a word D (EletE) W (ORD). The list of instructions is as follows: D Delete) Y Copy (PUT) P Placeminated (CHANGE) The range can be the following: E ​​Cursor location to the last letter W Clap in the word w Corker location to the next word The first letter B cursor where the first letter of the last word is the first letter of the cursor in the position to the last letter 0 cursor where the column is positioned to the first letter of the column. The number of the column is positioned to the next sentence The first letter (the first letter of the cursor to the first letter} cursor is located at the last letter of the paragraph to the last letter of the paragraph. The first letter of the paragraph is real, combined these instructions to edit the file. A little bit of art. No matter how, they provide more ability to edit text. It is worth noting that deletion and replication will put the contents of the specified range in the temporary area, then you can use the command P to other Location, this is a way VI used to handle segment copying and movement.

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

New Post(0)