VI use

xiaoxiao2021-03-06  84

The strongest editor - Vivi is the screen editor that all UNIX systems will provide, which provides a window device that can edit files by it. Of course, people who know the UNIX system, more or less feel that VI is super difficult, but vi is the most basic editor, so I hope the reader can learn it well, and will be smooth in the UNIX world. No hindrance, there is more exciting, because several other text processors are not unix standards. Maybe someone else's Linux machine is not installed Joe or Pico, if you don't vi, then you may not. The basic concept of VI can be divided into three operational states, respectively, of the command mode, insert mode, and bottom line mode, and each mode is as follows: 1. Comand mode: Controlling the movement of the screen cursor, the deletion of the character, or cursor, moves a certain section and enters Insert Mode, or go to Last Line Mode. 2. Insert Mode: Only in INSERT MODE, you can do text data input, press Esc, etc. can return to Comand Mode. 3. Last Line Mode: The file will be stored or leaving, or you can set the editing environment, such as looking for strings, listing line numbers, etc. However, the VI can be simplified into two modes, ie the Last Line Mode is also calculated into the Command Mode, divides the VI into Command and Insert Mode. VI Basic Operation • After entering the VI, enter the VI full screen editing screen after the system prompt symbol, you can enter the VI full screen editing screen: $ vi testfile has to pay special attention, it is that you enter Vi is in "Command Mode", you To switch to INSERT MODE to enter text. In the first time, users who use VI will want to move the cursor with the upper and lower left keys. As a result, the computer has been called, and she is half-dead, so after entering VI, do not move, turn into Insert, then said to INSERT. • Switch to the INSERT MODE Edit file You can enter the INSERT MODE in the Command Mode. At this time you can start entering the text. i: Insert, insert the input text from the current cursor where the cursor is located. A: Increase, the next word where the cursor is located begins to enter text. o: Insert a new line, enter the text from the heads. • Insert's Switch → Command Mode, press Esc Keys You are currently insert mode, you can only typing. If you find the wrong word, you want to use the cursor keys to move back. If you delete the word, press the ESC key to turn back to Command Mode, then delete the text. • Leave VI and File Under Command Mode, you can press the colon ":" to enter Last Line Mode, for example :: w FileName, save article into the specified file name filename): WQ (Input " WQ ", because the file name TestFile is already specified, so it will be written to the TestFile and leave the VI): Q! (Enter" Q! ", force to leave and give up the edited file)

After the command of the Command Mode command is introduced, the command is introduced, and the "common" function key is added later, indicating a relatively common VI directive, please read the reader, you must learn, remember. (1) I, a, o Switch into the Insert Mode. [Super Common] (2) Move the cursor VI to move around the cursor button directly on the keyboard, but the regular VI is using lowercase English letters H, J, K, L, respectively controls the left, under, upper and right, respectively. Move. Press CTRL B: The screen moves backwards. [Common] Press CTRL F: The screen moves forward. [Common] Press CTRL U: The screen moves halfpage later. Press CTRL D: The screen moves halfpage forward. Press 0 (Digital Zero): The beginning of the moving article. [Common] Press G: Move to the end of the article. [Common] Press W: The cursor jumps to the beginning of the next word. [Common] Press E: The cursor jumps to the next word of the word. Press B: The cursor returns to the beginning of the last word. Press $: Move to the row of the row where the cursor is located. [Common] Press ^: Move to the first non-blank character. Press 0: Move to the beginning of the line. [Common] Press #: Move to the # position of the row, for example: 51, 121. [Common] (3) Delete text X: Each time you remove a character behind the cursor. [Common] #x: For example, the 6x table deletes 6 characters behind the position of the cursor. [Common] x: Large words x, each of the previous characters in the location where the cursor is located once. #X: For example, the 20x table deletes 20 characters in front of the location of the cursor. DD: Delete the cursor. [Super Common] #dd: For example, the 6DD table deletes the text of the row of 6 rows from the row where the cursor is located. [Common] (4) Copy YW: Copy the character where the cursor is located to the buffer. (I want to oppose the function of # x, # x) P: Adhesive characters in the buffer to the location where the cursor is located (the instruction 'yw' must be used with 'P). YY: Copy the cursor. [Super common] P: Copy a single line to you want to paste. (Instruction 'YY' and 'P' must be used with use) #YY: If: 6yy indicates that the copy from the row in the cursor goes down the text. [Common] P: Copy Multi-line to you want to paste. (Instruction '#YY' and 'P' must be used) "AYY: Place the copy row into buffer a, VI provides buffer functionality, and the common data is buffer" AP: Paste it will be placed in Buffer A. "B3YY: Store three lines of data into buffer b." B3P: Paste (5) in Buffer B (5) Replace R: Replace the character where the cursor is located: [Common] R: Replace the character until you press ESC. (6) Recovery (UNDO) Previous instruction u: If you misconcenrate an instruction, you can press U and return to the previous operation. [Super common] .:. You can repeat the last instruction. (7) Change CW: Change the word to the word where the cursor is located. C # W: For example, C3W represents 3 words. (8) Jump to the specified line Ctrl G: List the line number of the row where the cursor is located. #G: For example, 15g, representing the first line of moving cursors to the article.

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

New Post(0)