VI command list

xiaoxiao2021-03-06  56

VI command list! EX, VI, View - TEXT Editors

◎ synopsis vi [-efglrrsv] [-c cmd] [-t tag] [-w size] [file ...] EX [-efgrrss] [-c cmd] [-t tag] [-w size] [file ...] ◎ Description EX and VI are the same, different interfaces, and EX is line-oriented, VI is a screen oriented. The two can switch each other. VIEW is equivalent to VI Use -R (only) parameter ◎ Options

-e starts with EX mode, as in editing with EX. Vi -e filename is equivalent to EX FileName

-F When editing for the first time, do not let VI whole file. (The preset is the entire file to avoid when you edit, others change this archive.)

-R is turned on in the reading mode, as in the VIPW, or set the ReadOnly parameter in the command column.

-r re-acquires a particular file. If no file is specified, the file list will be re-acquired. If there is no specified file, the file will be treated as no -r parameter editing.

-S starts with secure editing mode without allowing all external programs.

-s Enter the BATCH mode and can only be applied to EX editing. BATCH mode is very useful in Exf Scripts. Some timely information and other user-oriented messages are ignored (not displayed), and no start file or environment variable is read.

-w Sets the basic window size to define the number of lines displayed.

-v starts editing in VI mode, like VI or view commands.

EX / VI reads the message from the standard input, in the VI interface, if the standard input is not a terminal, an error will occur. In the EX interface, if the standard input is not a terminal, no matter how EX will try the command from him. However, it will be performed in a BATCH mode, as is the -s parameter being specified.

Move command: Move down to this word next time.

The title moves a screen.

Moves the number of rows (about 12 lines) down.

Put the screen to the top, but the standard position is constant.

Moves a screen down.

Move down to the next line of the first non-empty white character. is derived from moving a number of rows (about 12 lines).

Put the screen, but the label position is unchanged. Ctrl y is once per move (of course your candidate is at least moving at least)

The $ will move to the end of the row.

(Identity on moving to the previous sentence.

Move down to the next sentence down.

- Sign up to the first non-empty white character.

0 (Digital) Moves the first character (including blank) of the line.

> Moving this line moves to the right to move a Tab key distance, starting the action after the second time. B is moved to the beginning of the next word.

E The last word of the next word is moved to the next word.

Ng moves to a line, n is the number of lines, and if there is no specified, it is the last line of the file.

H moved to the first line of file.

L Move the laminated to the bottom of the screen.

M Move the marker to the middle line of the screen.

W moves down to the beginning of the next word.

^ Move to the first non-empty white character.

e moves to the last letter of the word.

F <元> The letter is searched and the letter is moved and the marked position is moved. Move to the A letter FA

The letter is searched in the T row and moved to the previous position of the character.

{Move it to the previous paragraph.

} Move down to the next paragraph.

Archive command: Show information. Show the current file change, the location of the row is displayed. File_name: unmodified: line 1 of 380 [0%]

Heavy painting screen.

Heavy painting screen. Pause Edit Back to Shell, available with FG back to the editing screen

Switch to the most edited file. VI file_name file_name2 can be switched in two files with this life.

ZZ archives the file and leaves the VI Edit command: Enter: I move the first character of the lacker, and start accepting the input.

R Enter the input mode in replacement mode.: Y this line to the temporary area delete: D Delete all the characters at the end of the label current position..

S Clear the line and enter the input mode.

X Delete the standard before replacing:! Shell command! Later Shell COMD, and replace the line with the SHELL CMD execution.! Panda replaces the original row with the following message Bash: Panda: Command Not Found

R Press R and then press a certain character to dispense the character.

~ Switching the size of the cells in the Switch: & the rule representation before the weight. Prerequisite is required to have a rule representation. Use Panda to replace A: S / A / PANDA / if there is no representation Then the system will display the following message No Previous Regular Expression

Here the VI command to change the contents of the file.

n Strings before search for the string. If the first execution / BSD is executed, the execution / BSD will have the following message No Previous search Pattern. Recovery: u Recovered status to the state of the launcher U restore the effect of the previous action (that is, reply)

Others:: Execute an ex command

J will take the next line with this.

Q Leave the VI mode and switch to the EX mode.

==================== Enter vi command ================================= Vi filename Open or The new file is created and the cursor is placed on the first line of VI N filename Opens the file, and the cursor is placed in the Nth-line head VI FileName Opens the file, and places the cursor to open the file in the last line of VI / PATTERN FILENAME, The cursor is placed in the first set of strings that matches the Pattern VI -R FileName generates a system crash when the last VI editor, restores the filename vi filename .... filename opens multiple files, and edits

=================== Mobile cursor class command ======================== H cursor left shift A character L cursor right shifted a character Space cursor right shifted a character backspace cursor left shifted a character k or a Ctrl P cursor Move a row j or a Ctrl N cursor shifted down the ENTER cursor shifted down a line W or W cursor right shifted Words to the header B or B cursor left shift a word to the header E or E c code right shift one word to the word tail) The cursor moves to the end of the word (the cursor moves to the sentence "cursor moved to the beginning of the paragraph {cursor to the end of the paragraph NG cursor is moved to the first N cursor minus N row N-cursor up shift N row N $ cursor to the N-line h cursor moved to the screen top line M cursor moved to the screen of the screen L. Move to the screen Line 0 (Note is a number zero) cursor moved to the current list of the cursor moved to the current row t ?????

================= screen roll class command ================================================================================================================================================ File Tail Halft Ctrl f Take a screen Ctrl b to file NZ to file NZ to the top of the screen to the top of the screen, and roll the current row to the top of the screen when NZ is not specified.

================== Insert text class command ================ i after the cursor before the current line A cursor A In the current row, the newly opened row o on the current row, replaces the current character R replaces the current character R Replace the current character and the following characters until the ESC key S starts from the current cursor position. The input text replaces the specified number of characters s deletes the specified number of rows and replaces the NCW or NCW modification of the NCW or NCW modification of the NCW or NCW to modify the specified number of rows ============= ===== Delete command ========================================= NDW or NDW delete cursor starts and after N-1 word D0 deletion To the head (deleting the first character of the current cursor begins to the first string) D $ deleted to the end of the tail (delete the current cursor where the characters in the end of the row) NDD deletes the current line and the subsequent N-1 line, And the cursor stays at the first non-empty character of the Nth line of the current line DD to delete the current row X or X delete a character, X delete the cursor, and the X delete the ctrl U before the cursor is removed in the input mode Enter text

=================== Search and replace the command ============================ / pattern starts from the cursor File Tail Search Pattern? Pattern Pattern starts from the cursor start Search Pattern N Repeat the last search command n In the inverse direction: S / P1 / P2 / G P2 all P1 in the current line Alternative: N1, N2S / P1 / P2 / G Rows all P1 in the ninth to N2 lines replacement: g / p1 / s // p2 / g All P1 in the file is replaced with P2

================== Option setting ============================ all list All Options Settings Term Set Terminal Type IgnoRe ignore the case in Search List Display Bit (Ctrl i) and Rights Sign ($) Number Display Line Route Report Displayed by Downtown Command Modified Number TERSE Show short Warning Information WARN When you transfer to another file, if you do not save the current file, the NOW WRITE message NOMAGIC is allowed in the search mode, and the special character NOWRAPSCAN that does not have "/" before use, when the VI is prohibited from being searched at both ends of the file, Starting from the other end MESG Allow VI to display other users to write information on their own terminals

===================== The last mode command ===========================: N1, N2 CO N3 will The content between N1 lines to N2 lines is copied to the N3 line: N1, N2 M N3 moves the content between N1 lines to N2 lines to Nth line: N1, N2 D will line N1 to N2 Delete: W Save the current file: e filename Open FileName for editing: x Save the current file and exit: q Exit VI: Q! Do not save the file and exit vi:! Command Execute Shell Command Command: N1, N2 W! Command uses the contents of the N1 lines into the N2 line as a Command's input and executes. If N1, N2 is not specified, then the entire file content is used as a Command: R! Command puts the output of the command Command to the current line ================== Register operation ============================== === "? NYY saves the current line and its N r line to the register? Where? is a letter, n is a number"? "NYW saves the current line and its n word to the register? In this, it is a letter, n is a number "?" NYL saves the current line and its n characters to the register? Where? Is a letter, n is a number "? P Remove the register? The content is placed in the cursor position. Here? Can be a letter, or a digital NDD deletes the current row and its total N line text and put the deleted content into the No. 1 delete register.

======================= Multi-line comments ======================== ============ If you want to give a multi-line program, a stupid method is to insert #, then skip to the next line with J. command, repeat the last command. If you want to note hundreds of lines, this method is probably too stupid. A clever approach is:

:., 499 s / ^ / # / g

======================= encrypted file ====================================================================================================================================================================== ======== x You can enter a password under prompts. ======================== Use the roller mouse under VIM ============================================================================================================================================================== = This article comes from: http: //www.freelamp.com author: Xu permanent (2002-03-01 08:02:00) great wheel mouse, right? We have to roll him under the VI program. Don't need to press CTRL-F / CTRL-B!

If you like to use VIM to edit files under xterm, you can use the roller mouse to use the roller mouse under Vim. This tip of this article can help you achieve this dream.

You need to put the following code ~ / .xdefaults file:

Xterm * vt100.translations: #Override / N /: String ("0x9b") String ("[64 ~") / N /: String ("0x9b") String ("[65 ~") / N /: String "0x9b") String ("[62 ~") / N /: String ("0x9b") String ("[63 ~") / N /: / N /:

Then, modify the VIMRC file, establish a mapping for the above binding:

MAP [62 ~ map! [62 ~ map [63 ~ map! [63 ~ map [64 ~ map! [64 ~ map [65 ~ map! [65 ~

Ok, now you can use the roller to roll the VIM screen. Forget Ctrl-F and Ctrl-B.

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

New Post(0)