Vi/vim Delete and other commands

Source: Internet
Author: User

Tags: use should space character pre IPS and save LSE RAC

Delete one line: DD

Delete a word/cursor after the remainder of the word: DW

Delete Current character: X

The line part after the cursor: d$

Text deletion

DD Delete a row

d$ delete a line of characters starting with the current character

NDD deletes n rows starting at the current line

DW Deletes a word starting with the current character

NDW delete N words starting with the current character

D synonymous with d$

d) Delete to the beginning of the next sentence

D} Delete to the beginning of the next paragraph

D Enter Delete 2 rows

NDW or NDW deletes the n-1 characters at the beginning and after the cursor.
D0 deleted to the beginning of the line.
d$ deleted to the end of the line.
NDD deletes the current row and its subsequent n-1 rows.
x or X to delete one character.
Ctrl+u deletes the text entered under input mode.
^r Recovery U operation
J Merge the next line to the end of the current line
V Select a row
^v the selection of the rectangle after pressing the ^V
AW Select words
IW internal words (no spaces)
As select a sentence
is select sentence (no spaces)
AP Select Paragraph
IP Select paragraph (no spaces)
D Delete to end of line
X, y Delete and copy contain highlighted areas

DL deletes the current character (same as x command function)
D0 Delete to the beginning of a row
d^ Delete to the first character position of a line (excluding spaces or tab characters)
DW Delete to the end of a word
d3w Delete to the end of a third word
DB Delete to the beginning of a word
DW deletes the end position of a word with a space separator
DB Delete to the beginning of a word with a space separator
d7b Delete to the beginning of the first 7 words with spaces as separators
d) Delete to the end of a statement
D4) Delete to the end of the fourth statement
D (Delete to the beginning of a statement
d) Delete to the end of a paragraph
d{Delete to the beginning of a paragraph
d7{the 7th paragraph position before the current paragraph start position is deleted
DD Delete When moving forward
D/text Delete the position of the typeface specified in text
Keep moving forward until the next occurrence of the word (but not including the word) between the content
The DFC deletes the position from the text where the character "C" appears, moving forward until the next occurrence of the character (including the character) between the contents
DTC deletes the current row until the next character "C" appears between the contents of the position
D Delete to the end of a line
d$ Delete to the end of a line
5DD Delete 5 rows from the current line
DL delete content until the last line on the screen
DH deletes the contents of the first line until the screen
DG delete content until end of work buffer
D1G Delete content until the working buffer starts

Move cursor in VI
  K        Upper H   L  right  J        down ^        move to the first non-space character of the line prompt W move        forward one word, the symbol or punctuation as the word processing W        move forward a word, Do not place a symbol or punctuation as a word processing B        move backward through a word, place a symbol or punctuation as a word processing B to        move backward through a word, without the sign or punctuation as the word processing (the        cursor moves to the beginning of the sentence) the        cursor moves to the end of the sentence {        Move the cursor to the beginning of the paragraph} The cursor moves to the end of the paragraph H cursor moves to the top line of the screen m cursor moves to the        Middle Line of the screen L        cursor moves to the last line of the screen 0        to beginning $        to line end GG       to top g        To the end of the page +g   jumps to the specified line n+       the cursor moves n rows, the n       -cursor-up line, ctrl+g   queries the current line information and the current file information FX       jumps right to the bank character X (x can be any character) FX       Jump left to the bank character X (x can be any character) TX       and FX The same, the difference is to jump to the character x before the TX       and FX The same, the difference is to jump to the character x after c-b scroll      up one screen c-f scroll      down one screen c-u      Scroll up half screen c-d scroll      down half screen c-y scroll      up one line c-e scroll down one      line NZ       
Enter and Exit VI command
VI filename Opens or creates a new file and places the cursor at the beginning of the first line VI +n filename to open the file and places the cursor at the            beginning of nth line VI + filename to             open the file and place the cursor at the end of the line VI +/pattern FileName     Opens the file and places the cursor at the first string that matches the pattern vi-r filename            crashes when you last edited with VI, recovers FILENAMEVI filename ... filename  Open multiple files, then edit ZZ to                        exit VI and Save: q!                       Exit VI, do not save: Wq                       exit VI and save
Repeat operation
.        Repeat Last Action
Auto-Completing
C-n      match next keyword c-p      match previous keyword
Insert
o        open a new line below the cursor and place the cursor at the beginning of the new line, into insert mode. O        Ibid., above the cursor. A        enters insert mode after the cursor. A        Ibid., before the cursor. R        Enter replacement mode until you press Escset XXX to  set the XXX option.
Row merge
J        Merge The following line behind the bank
VI Find and Replace commands
/pattern         from the beginning of the cursor to the end of the file search Pattern?pattern from the beginning of the cursor to the top of the         file Patternn                in the same direction repeat the last search command n                in the opposite direction repeat the last search command%                Find pairs of parentheses: s/p1/p2/g       all the P1 in the current row are replaced with P2, and the GC option should be used if each substitution asks the user: N1,n2s/p1/p2/g  all N1 in the N2 to P1 row are replaced with P2: g/p1/s//p2/g    Replace all P1 in the file with P2. The *[]^%~$ has a special meaning in VI, and the escape character "\" should be added if you need to find it.
Find some options to set highlighting
: Set Hlsearch    Set highlight: Set Nohlsearch  off highlight: Nohlsearch      Close the highlight that is currently set
Incremental Lookup
: Set Incsearch   Set incremental lookup: Set Noincsearch close Incremental Lookup
Delete in VI
x        Delete the character under the current cursor DW       deletes the remainder of the word after the cursor. d$ the       remaining portion of the line after the cursor is deleted. DD       deletes the current line.        the C function is the same as D, except that when the delete operation is completed, the insert MODECC       is deleted and the current line is removed, and then the insert MODE is entered
Change character
Rx       Changes the character under the current cursor to X (any character x) ~        

Keyboard macro Actions
Qcharacter  start recording macro, character any character from A to Z Q           stop recording macro @character  call previously recorded macro
Recovering from a false operation
U        undo the last executed command u        fix the previous operation on the line ctrl+r   Redo
Operate the frame in VI
C-w c-n  Increase framec-w c-c  decrease framec-w c-w  switch framec-w c-r  swap two frame
Block operations in VIM

Vim supports up to 26 clipboard

     Select a block first with v,c-v,v, and then copy with Y, and then paste with P.  yy     Copy the current entire row  nyy    copy the N-line content at the beginning of the current line  ? Nyy saves the contents of the   current line and its next n rows to the register?, where? is one letter and N is a number  ? NYW   Save the current line of the cursor and its next n words to the Register?, where? is one letter and N is a number  ? nyl   Saves the current line of the cursor and its next n characters to the Register?, where? is a letter, n is a number  ? p     Pastes the contents of the register into the cursor position. If it is a full line copied with yy,         paste it under the line where the cursor is located. Here? Can it be a letter, or can it be a number   ? P     Pastes the contents of register a before the cursor position. If it is a full line copied with yy,         paste it on top of the line where the cursor is located. Here? can be a letter or a number   ay[motion]            ay$    Copy the cursor position to the end of the line and save in register a            ayft   copy the cursor position to the current line the first letter T and save in Register a

All of the above instructions can be removed from a work, then y,p works on the unnamed register (all D,c,x,y objects are saved here).

Cut/Copy/paste

All deleted contents are saved automatically and can be pasted with P key.

Option settings for VI
         all lists all option settings        for the term set Terminal type ignorance   in search ignore case list        Display tab stop (CTRL+I) and Line end flag ($)      number display line numbers report      Displays the number modified by the line-oriented command terse       displays a short warning message warn        If the current file is not saved when you go to another file Nomagic     allow in search mode, use the front without "\" The special character Nowrapscan  prohibit VI when the search reaches the end of the file, and then starts at the other end MESG        
Tips

Automatic formatting of code GG=G

In Vi/vim, jump to the end of the file shortcut key:

File start: Shift + G

End of File: G g

From:http://dsec.pku.edu.cn/~jinlong/vi/vi.html

From:http://www.caole.net/diary/vim.html#sec-1

Vi/vim Delete and other commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

Tags Index: