One, move the cursor # hjkl# 2w forward two words # 3e move forward to the end of the 3rd Word # 0 Move to the beginning of the line # $ The end of the current row # GG file The first line # G file last line # line number +g Specify line # <ctrl>+o jump back to the previous position # & Lt;ctrl>+i return to the position before the jump two, exit # <esc> Enter normal mode #: q! Do not save exit #: Wq save after exiting three, delete # x Delete current character # DW Delete to current word end # de Delete to current word end, including current character # d$ Delete to current line end # DD Delete whole line # 2DD Delete two lines four, modify # i insert text # A Current line End Add # R replaces the current character # O opens a new line and enters insert mode five, Undo # u Undo # <ctrl>+r Cancel undo six, copy paste # V into visual Mode # y copy # p paste # yy copy current line # DD cut current line seven, find #/forward lookup (n : Continue to find, N: Continue looking in the opposite direction) #? Reverse Lookup #% find paired {, [, (#: Set IC ignores case #: Set noic suppress Case #: Set HLS match Highlight #: Set is display partial match eight, replace #: S/old/new Replace the line with the first matching string #: S/ol d/new/g Replace full line matching string #:%s/old/new/g replaces the entire file's matching string
VIM basic Commands