Vim has no menu, only commands
VI FileName---> Enter command mode to enter the edit mode directly, enter the end of the run, input Wq save and exit
In command mode: Enter AIO into insert mode, ESC returns to command mode
A, after the cursor A, the end of the line
I, front of cursor I, beginning of line
O, insert a new line under the cursor
Command:
___ Location Command
: Set Nu/set Nonu
Gg/g to first line, last line
ng =: N to nth row
$/0 move to end of line/beginning
___ Delete command
X/nx Delete the character of the cursor/n characters
DD/NDD, row, n rows
D/DG To line end/to end of file
: n1,n2d The row of the specified range
___ Copy and cut
Yy/nyy copying when moving forward
DD/NDD Cut
p/p paste in the line below/above the current cursor
___ Replace and Cancel
R replaces the character at which the cursor is located
R replaces the character at the point where the cursor is located, press ESC to end
U Cancel the previous action
_______ Save and exit
: W Save changes
: w new filename
: Wq Save Exit
ZZ Ibid.
: q! Exit does not save
: wq! Same as: Wq, file owner and root can be used
_______ Search and search replacements
/string searching for a specified string
: Set IC ignores case
N Find the next
:%s/old/new/g full text overrides specified character
: n1,n2s/old/new/g within the specified range ....
___ Usage Tips
: r! command
Import command Execution results
: Map
Defining shortcut keys, triggering commands
: Map ^p i#<esc>//Line Header Insert # comment. ^ is not a character, but a display after Ctrl + V input
: Map ^b 0x//Delete first character
: AB
replacement, eg,: AB mymail [email protected]
: n1,n2s/^
Front is the range, ^ represents the beginning of the line
: n1,n2s/^/#/g Continuous Line Comment
: n1,n2s/^#//g uncomment consecutive lines
: N1,n2s/^/\/\//g The beginning of the comment//. \ is the escape character, \/is the meaning.
_______
. VIMRC
Config file, in home directory
Linux Learning 5 Text editor vim