Delete the current cursor position to the end of the line content
dG
Delete the contents of the row cursor to the end of the file
D
Delete at the cursor to the end of the line content
: N1, n2d
Delete the specified range of row
To pay attention to when using the backspace and delete keys in normal mode vim editor. vim editor will usually delete key function of the command identified as x, to delete the character at the current cursor position.
Copy and Cut
command
effect
yy
Copy the current line
nyy
Copy the following line n the current line
dd
Cut the current line
ndd
The current line n line hereinafter
p、P
Paste or row at the current cursor line
Replacement and cancellation
command
effect
r
Replace the character at the cursor location
R
To begin replacing characters from under the cursor, press Esc to end
in
Cancel the last action
Search Search and Replace command
command
effect
/string
Ignore case when searching for the specified search string: set ic
n
Search for the next occurrence of the specified string position
:%s/old/new/g
Replace text specified string
:%s/old/new/gc
Replaces the specified text string, but prompted at each occurrence,
:n1,n2s/old/new/g
Alternatively all old line number between n1 and n2
Save and Exit
command
effect
:w
Save changes
:w new_filename
Save for the specified file
:wq
Save changes and exit
:ZZ
Save changes and exit
:q!
Quit without saving changes
:wq!
Save the changes and exit the root available
Import command execution results
r !命令
Defined shortcuts
map shortcut keys trigger command ctrl + v and ctrl + p is defined shortcuts ^ p (ctrl p)
Continuous line comments
:n1,n2s/^/#/g (行首添加 #)
:n1,n2s/^/\/\//#/g
Profiles
/home/username/.vimrc
/root/.vimrc
nano editor
The caret (^) indicates whether the Ctrl key.
nano control commands:
command
description
Ctrl + C
And then displays the cursor position in the text editing buffer