Use of Vim under Linux

Source: Internet
Author: User

Moving the cursor in VIM is a big difference from other editors, but once you learn it, you'll quickly move through the text.
Copy and paste
DD Deletes the cursor in the row
DW Delete one word (word)
X Delete Current character
X Delete the previous character
D Delete to end of line
yy Copy a row, this command can be followed by a number, identity copy multiple lines, such as 6yy, to start copying 6 rows from the current line
YW copy a word
y$ Copy to end of line

h,j,k,l, down, left, right .
ctrl-f up a page
ctrl-b down one page
% jumps to the parentheses that match the current bracket, as currently in {, jumps to the matching}
W Jump to the next word, split by punctuation or word
W jumps to the next word, long jump, as end-of-line is considered a word
e jumps to the end of the next word
E jump to the end of the next word, long jump
b jumps to the previous word
B jump to the last word, long jump
0 jumps to the beginning of the line, whether or not indented, jumps to the No. 0 character
^ jumps to the first character of the beginning of a line
$ jump to end of line
GG jumps to the first line of the file
GD jumps to the declaration of the variable at which the cursor is currently located
[n]g jumps to Nth row, such as 0G, which is equivalent to gg,100g is the 100th line
FX finds the X character in the current line and jumps to
; Repeat the previous F command without repeating the input FX
TX is similar to FX, but only jumps to the previous word of X prompt
FX and FX are in the opposite direction
), (jump to Upper/Next Statement
* Find the word where the cursor is located and look down
# Find the word where the cursor is located, look up
`. Jump to last edit location
move on the screen
H Move the cursor to the top line on the current screen
M moves the cursor to the middle line on the current screen
L Move the cursor to the bottom line on the current screen
Bookmark
Ma saves the current position as a label
' a jumps to label a
Edit
R replaces one character
J connect the next line and the current row as a row
CC Deletes the current line and enters edit mode
CW Deletes the current word and enters edit mode
C $ Erases content from the current position to the end of the line and enters edit mode
s Delete the current character and enter edit mode
S Delete the line of the cursor and enter edit mode
XP swaps the current character and the next character
u undo
Ctrl+r Redo
. Repeat last Edit command
~ Toggle Case, current character
G~IW Toggle the case of the current word
GUIW the current word into uppercase
GUIW the current word into lowercase
>> Move the current line one unit to the right
<< moves the current line one unit to the left (one tab character)
= = Auto Indent current line
Insert Mode
I enter insert mode from the current cursor
I go into insert mode and place the cursor at the beginning of the line
a append mode, with the cursor positioned after the current cursor
A Append mode with cursor at end of line
o Add a new line below the current line and enter insert mode
O Add a new line above the current line and enter insert mode
ESC exits insert mode
Visual Mode
Tag Text
v Enter visual mode, single character mode
V Enter visual mode, line mode
Ctrl + V enters visual mode, column mode, similar to UE's column mode
o jump cursor to another endpoint of the selected block
U Turn the contents of the selected block into uppercase
O jump cursor to another endpoint of the block
AW Select a word
AB selects everything in parentheses, including the parentheses themselves
AB selects all contents of {} brackets
IB selects the bracketed content without parentheses
IB selects the contents of {} without {}
to act on a marker
> block Right Shift
< block shift left
y copy block
d Delete Block
~ Case of content in toggle block

Use of Vim under Linux

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.