Vi/vim/gvim Editor Common commands

Source: Internet
Author: User

Mobile

KJHL move cursor up or down
GD find the current location defined by Word, n jumps to the next place
NG jumps to nth row
% in range characters (bracket pairs, HTML tags, etc.)
{} Move up/down between empty rows
() Move between paragraphs, including blank lines
Ctrl+o in turn follow the jump record to jump backward
Ctrl+i jumps along the jump record in turn
Ctrl+e single-row upward tumbling
Ctrl+u Half screen upward tumbling
B, B move forward one word or word

"edit"  
x Delete the current cursor text  
rx    Replace the current cursor character with x 
J next line to the end of the current line  
.   repeat the previous Operation Command, DD ... Will delete 4 lines of text, J .... You can connect 4 lines of text  
d   can be used to combine any move command  
dw    Delete the current cursor to the beginning of the next word  
d%   Delete the contents of the range between the  
D)   Delete to the end of the next sentence  
D} Delete the remainder of the current paragraph  
du undelete preparation
DD cut the current line
yy complex     The word
yw where the current line
DW clipping cursor is located:
P Paste   at the location where the cursor is copied,
I insert   at the current line,
A   inserts   at the end of the current line;
O Creates a new blank line below the current line for inserting  
O   Creates a blank line   above the current row;
CC replaces the current line contents with a blank line  
c$  Delete the current position to the end of the current line  
c0         deletes the current position to the current line start content  
==  automatically indents the current line  
GG jumps to the first line
G jumps to the last line
gg=g    automatically indents the full text  
<< (>>) indents the entire line  

"Find/Replace"
/regexp Find REGXP content, n jumps to the next place
: s/regexp/replacement/g Replace when moving forward
:%s/regrep/replacement/g Full text replacement, if one row has multiple matches only replace the first one
:%S/REGEXP/REPLACEMENT/GC full-text replacement and prompts before each replacement
:%s/str/\r/g Replace and wrap

"File Operations"
W Save
Q exit
QW exit after saving
Q! Force exit
W! Force write
: Help opens the Gvim helper file

PS: Enter Vimtutor in the Linux terminal to open the starter tutorial with vim

Vi/vim/gvim Editor Common commands

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.