Linux command to edit learning -VIM

VIM command editor

Normal mode

vim + files as they enter is the normal mode
ESC Press ESC to return to normal mode
i to enter edit mode, the last line prompt "Insert" can insert text
I or shift + i to enter edit mode, the cursor is at the beginning of the current line
a enter edit mode , the cursor will be the next time the cursor position on the front
a to enter the edit mode, the cursor at the end of the current line
o edit mode, insert a row down, the cursor at the beginning of
O or shift + o edit mode, insert a row direction , at the beginning of the cursor
around the cursor movement hjkl
p paste, insert a row down and paste
yy copy the current row
3 + yy from the current row, three rows of replication, 3 may be modified
y + $ copy from the current position of the cursor to the end
the current line dd
d + $ shear from the current position of the cursor to the end of
3 + dd from the current row, three rows of shear, 3 may be modified
u undo operation, the multilayer revocation
CTRL + r re-execute the undo operation , undo Reverses
x cursor on which a character, that character is deleted, delete the specified character
r cursor on which a character, press r, lose New characters can be replaced
: set nu digital display line
begins with a number or numbers + shift + g + G cursor jumps to the specified row
g cursor jumps to the beginning of the first row
G or shift + g cursor jumps to the last line beginning
shift + 6 (^ symbols) line cursor to the beginning of the current
shift + 4 ($ symbol) move the cursor to the current line at the end

Command line mode

Press ESC to enter the normal mode, enter ":" into the command line
w to save the file
w /root/a.txt saved to a directory, and named a.txt
quit q
WQ save and exit
q does not save, quit!
:! + linux commands, such as
:! ifconfig See local ip
/ find, for example, / 3 3 to find and press /, input 4, / 4 4 look
- n for a matching character
shift + to find a match on the n character
s / old / new row at the current cursor replacement character, look Old, replaced with new new, replacement of only a character to match
% s / old / new row for each match and replace only replace each row first matching character
% s / old / new / g of paper are matched and replaced
3,5s / old / new match in the fifth row and the third to replace
set nohlsearch remove the highlighting
set nu display line no
set nonu not display line numbers

Visual mode

Manner into the three kinds of visual mode

  • v character visual Mode
  • Visual mode line V
  • Visual-block ctrl + v
    • With d and I may operate the command block

Guess you like

Origin www.cnblogs.com/chenri/p/12590327.html