The operation command Daquan linux vim

vim operation

vim operating mode

Here Insert Picture Description

Command Mode

command effect
a Inserted after the character under the cursor
A Inserting the end of the line the cursor
i Be inserted before the character under the cursor
I The first insert the cursor line
O New line is inserted at the cursor
O Insert a new row on the cursor

Input Mode

Input mode is mainly used for text editing.

Edit mode

command description
:w Save not quit.
: W new file name Save the file as a new file.
:q Exit without saving.
:wq Save and exit.
:! Mandatory.
:q! Forced to exit without saving, the revised document for exit without saving the data.
:wq! Forced to save and exit, there is no time for write access, data is written to force.

Command mode operation

vim configuration

Carriage return after all only need to enter the command in command mode.

Setting parameters description
: Not set /: set nonu Display, cancel the line number.
:syntax no/:syntax off Whether to display the associated color syntax help basis.
:set hlsearch/:set nohlsearch Set whether the searched string highlighted.
:set ruler/:set noruler Set whether to display the status bar in the lower right corner.
:set showmode/:set noshownode Set whether to display the status bar at the bottom left corner INSERT and the like.
:set list/:set nolist Set to display hidden characters (Tab and the like).

Move the cursor

command description
h Left movement
j Move up
k On the move
l Right movement
gg Move to header
G Move to the end of file
^ Move to the beginning of the line
$ Move to the end of the line
:n Move to the beginning of the line n

Delete, cut

command description
x To delete a single letter
nx After you remove the cursor n letters
dd Delete a single line
ndd Delete the cursor after the line n
:n,md Delete rows n to m
p (small) Paste cursor
P (large) Paste before the cursor
dG Delete the line the cursor to the end of the file line

copy

command description
yy Single line copy, and paste the copied using p
nyy Copy n lines, the copy and paste a p

Undo

command description
in Undo
Ctrl+r Anti revoked

replace

command description
r Replace the character at the cursor
R To begin replacing characters from under the cursor, press ESC End

Seek

command description
/ Find content Look down from the cursor line
? Find Content Find upwards from the cursor line
n next
N Previous

replace

command description
:n,ms/old/new/g n row m to replace old new
:%s/old/new/g old entire file is replaced with new
Published 233 original articles · won praise 189 · views 390 000 +

Guess you like

Origin blog.csdn.net/sinat_32366329/article/details/104082006