This article is agreed: # vim indicates that enter the VIM uppercase letter under the shell, such as a represented to type Shift a ^ g to indicate Ctrl g: x Indicates that in the command mode Type 'colon' and X normal commands, such as i is in command mode Type direct response
[Help]: Help (Help I still don't use it, I will make up :)
Command Mode and Insert Mode】 Vim is just in command mode, and any input is interpreted as a command. To enter the insert mode, enter the i command (insert mode in the following detailed description)
Open: # Vim Open a new editing # Vim File Open File # Vim N File Opens File and move the cursor to the NP # Vim / Word file open file and positioned in Word's first appearance
Exit: Type in command mode: q Exit: Q! Forced exit (lost modification): W Save: w! Forced Write: w File Save to File: X Save and exit, equivalent commands: WQ
Reading files:: R file Read File: NR File Reads File After the Nth Row
Move in text: H = before, J =, K = upper, L = after. (You can also add numbers before command, such as 3h is a forward shift 3) (Tips: Vim Many commands can add numbers to represent execution times, try seeing) g Jump to file tail NG to the NG NG ( With the order: n) ^ g Show line number 0 or ^ jump to the first $ 10 Trouk to the next word first character E jump to the next word tail character B Jump to the previous word first character - jump to One-line first jump to the next line of the first N | Jump to the current line N-column L Jump to this page Last line of the first line of the first M jump to this page, the first line of the first hip to this page
Cursor positioning: f $ Skip to the Bank Next $ Version F $ Skip to the Bank Previous $ T $ Skip to the Bank Next $ Front A Character T $ Skip to the Bank Previous $ Multiple One Character
Display adjustment: (Cursor automatically makes the corresponding shift) ^ D over the half page ^ U on the top of the page ^ f Next page ^ b
Display setting: (Several commonly used): SET NUMBER Display line number: SET SHOWMODE Displays the current mode: SET SHOWMATCH indicates the parentheses: set autoindent automatic indentation: set tabstop = value Sets the Tab width, the default is 8
Insert mode: i in front of the current character (try 4i Hello effect:) i Insert a in the leader A in the current character, insert a in the row, inserted the new line O, inserted the new line J to incorporate the next line Current Row Delete (Cut): X Delete Current Character X Delete The previous character DW Delete Current characters The words include the wordkeck (part after deleting the cursor) DD Delete the current row D $ delete the current character to the Bank (with command D): m, ND Delete M ~ N line: ND Delete Nth Row
Modify: r Start to rewrite the CW from the current character (modify from the current character) S Modify the current character r Modify the current character (modify a character) S Modify the current line (with the command CC) c Modify from the current character to the end Content C Any cursor positioning command, modify the target content, such as CFA modify the content of the current character to the next A
Undo: u Undage Previous Operation (This command is different in various system implementation, and the FREEBSD 4.11 "is revoked under Windows) U withdrew all the operations of the Bank
Redo: ^ r Reduced the operation of the previous UNDO (same: redo)
Find :: / Word Find Word:? Word Find Wordn to look up in the current lookup direction to find the next wordn in reverse look up in the current lookup direction::? Love Find the first love before the cursor, Press n to find a longer one LOVE. % Find the matching parentheses (programmers favor)
Replace :: S / SRC / DST Replace the first SRC search for the Bank to DST: S / SRC / DST to replace all SRCs in DST: S / SRC / DST / G to replace the SRC of the Bank For DST: $, $ ... S / SRC / DST / G replace SRC for DST in the specified range, $, $ ... for specified line numbers, examples: 2, 5, 6 s / hi / hello / g
Copy and Paste: YY Copy The current row YW Copy word (copy from the current character) Y cursor positioning command, copy the target content, such as YFA any delete command deleted content in the buffer, can be pasted. P Paste P in front of Paste: M, N Copy X is copied by the character: m, n Copy x copy m ~ n line content to the X row #COPY can be abbreviated as CP: M, N Move X After moving M ~ N lines to the X line #MOVE can be short-handed as MO mapping, abbreviation, and tag: M $ with a $ letter tag current line '$ jump to the tag line: Map $ Command will map command commands or keys to $: AB $ char-string Ges to Char-string an abbreviation $, inserting $ will automatically expand in text
Run the shell command in VIM ::! Command such as ::! Ls :! tcsh :! GCC Test.c Compile the edited content (to be saved first)