VI Profile Linux operation

zhaozj2021-02-11  237

Introduction to VI

VI is an extremely popular full-screen book editor in 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. VI Basic Concept Unix provides a range of EX editors, including EX, EDIT, and VI. Compared with the full screen editor, it is now possible to imagine how to use EX, Edit, which has been used by 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, 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. (Available in Unknow Terminal Type at unless you perform VI, you can set it without setting.) As long as you perform VI, you 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 reach some arranging files, archives, and leave VI, and the like. When VI is executed, you will enter the instruction mode, and any of the characters entered at this time is considered to be instructions. Entering and leaving To enter the VI can be used directly under the system prompt cell name>, VI can automatically help you 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], and you can make a beep to determine the entry instruction mode. How do I 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 very important, especially in computer, you can try and verify the results at any time. It is best to use it to use it without a fierce, and there is a halving utility. (Note: This paragraph is nonsense.) VI Basic Edit The function keys on the general keyboard, like the direction keys, [INSERT], [Delete], etc. Now, you should already use VI to process text information.

Of course, VI also provides many other features to make the 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 keyboard, terminal, etc. often have different specifications. What does this represent? In the editing software of the instrument, there will be such problems, and there are no specific functions on the keyboard of some computers! 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 only 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 is the same as the [UNDO] button on some computers. VI advanced applications believe that now there should be considerable understandings for 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 cursors are positioned by a cursor by a cursor, so VI provides a number of mobile cursors, this series of briefs are illustrated (these of course are instructions in instruction mode): Instruction Description Function key 0 Move to the cursor The front [Home] $ Move to the last side of the cursor [end] [ctrl] [d] to the next page [Ctrl] [f] Next page [PageDown] [Ctrl] [u] to the upper page [Ctrl] [b] To the previous page [PageUp] h Move to the first column M moved to the window M move to the intermediate column of the window to move to the last column B moving to the window to move the first letter W moving to the previous word. The first letter E moved to the next word ^ moved to the first non-empty-white character n-minus number of the cursor where the cursor is located to the first non-empty white character, front plus The number can be specified to move to the first non-empty cell that moves to the next column to the next column, the front plus the number can be specified to move to the following N-column NG Direct Digital N plus uppercase G move to Number N column FX Move the right to the X-cell to move to the left to the X-cell to move to the right to move to the X-character TX to move to the x-character to the x-character; mix F & T, repeat, with F & T, reverse direction One / String moves to the right to the right place? String moves to the left to the String place n-match / &? Use, repeat N-match / &? Use, repeat one instructions in the reverse direction Description Note N (left brackets move to The top of the sentence, before adding the number, the number can be specified to move the n sentences in the forward moving N) the first front, the front side plus the number, the number can be specified to move backwards. N of the N-sentence N {the front, the front plus the number, the number can be specified to move the N paragraph paragraphs in front of the paragraph, and the number of blank columns between paragraphs will be used to move to the top of the next paragraph, front plus The numbers can specify that the N paragraphs will 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 narrative itself. 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 information with me. In addition, this paragraph is nonsense.) Advanced Editing instructions are very flexible, basically, can be made up of instructions and scope. For example, DW is composed of deletion command D and the range W, and the representative deletes a word D (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 capabilities of editing text. It is worth noting that deleting and replication will put the contents of the specified range in the temporary area, then you can use the instruction P to other places. This is a way VI to process segment copying and movement. Some VI versions, such as the ELVIS used by Linux can greatly simplify this command.

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

New Post(0)