Vim Commands and configurations

Source: Internet
Author: User
Tags tag name

1. Cursor movement

L Move one character to the right
H Move one character to the left
W Move one word to the right
W Move right One blank separator word
B Move one word to the left
B Move left a blank separator word
$ Move to end of line
E Move right to the end of a word
E Move right to the end of a blank separator
0 Move to the beginning of a line
Return Move to the beginning of the next line
J Move down one line
- Move to the beginning of the previous line
K Move up one line
) End of sentence
( First sentence
} End of paragraph
{ Paragraph head
%

2. View the work buffer

^d Move down half of the window
^u Move up half of the window
^f Move down one window
^b Move up one window
20g/g Move to Line 20th/move to end of file
H Move to the top of the window
M Move to the middle of a window
L Move to the bottom of the window

3. Add text

I Insert before cursor
I Inserts the current line header
A Insert after cursor
A Current line End insert
O Inserts a new row below the current line
O Insert new row above current line

4. Delete and modify text

20x Delete 20 characters
20X Deletes 20 characters before the current character
20dd Delete 20 rows
Dtc Delete until the C character appears
D Delete to end of line
20~ Change the case of the following 20 characters
S Replace
S Replace Whole line

5. Search

/rexp Search down the regular expression
? rexp Search up
N Repeat search in same direction
N Repeat search in reverse direction
/ Repeat Search down
? Repeat Search up
Fc The cursor is positioned over a C character on the current line
Fc The cursor is positioned where the first occurrence of the C character occurs at the current line
Tc The cursor locates the previous character of a C character that appears on the current line
Tc The cursor is positioned after a character with a C character on the current line
; Repeat the last f F t command executed

6. Other Orders

J The current line and the next line are connected
. Repeat the most recent modification command
: W File Writing to file files
: Q Quit Vim
Zz Exit and save
: F or ^g Status now
^v Insert Next character

7. Yank and put command

YM Move out of the text specified by M
20yy Move out of 20 lines
Y Move out to the end of a line
P Insert Text above
P Insert text below

8. Advanced command

Mm Set tag name M
' Two ' The cursor moves to the previous position
' m The cursor moves to the tag line m
' m The cursor moves to the character labeled M
: E File Edit File
: N Edit Next file
: Rew Returns the first file
: SH Start shell
:!cmd Execute cmd
!! Cmd Execute cmd and replace the output with the forward

9. Miscellaneous

: W Write to Hard disk
: Wq Leave after writing hard drive
Ctrl+p Find a match backwards
CTRL + N Forward Lookup match
Gg Move to the first character in a document
Yy Copy the line where the cursor is located
Dd Delete the line where the cursor is located
20yy Copy 20 rows of data including cursor lines
20dd Delete 20 rows of data including the cursor line
Dg Deletes all data from the line to the last line of the cursor
YG Copy all data from the row to the last line of the cursor

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.