Vim shortcut (simple version)

Source: Internet
Author: User

Vim shortcut keys, in order to prevent too cumbersome, only write their usual, follow-up supplement. Introduction to the article Vim Basic learning, detailed see reproduced in the article Vim shortcut key

1. Open the file Vim + file starts at the end of the file.
Vim +num file starts at line Num.
Vim +/str file opens file and pauses the cursor on the first STR found.
: E file closes the currently edited files and opens a new file.
: E+file start a new file and edit it from the end of the file.
: E+n file starts a new document and edits from Nth line.
2. Cursor movement 0 Move to the beginning of the line.
$ move to the end of the line.

G0 moves to the beginning of the screen line where the cursor is.
g$ move the end of the screen line of the cursor.
n| Move the cursor over the nth column.
NG to the nth line of the file.

H move the cursor to the top row of the screen.
M move the cursor to the middle line of the screen.
L move the cursor to the bottom line of the screen.
GG to the head of the file.
G to the tail of the file.

ZZ moves the current line to the center of the screen.
ZT moves the current line to the top of the screen.
ZB moves the current line to the bottom of the screen.
3. Insert I insert before the cursor.
A is inserted after the cursor.
I Insert the first non-empty word match either in the current line.
A is inserted at the end of the current line.
o Insert a new line below.
O Insert a new row above.
4. Replace R replaces the character at the cursor
R into replace mode, press ESC to return to normal mode.
: S/old/new-Replaces the first old of the current line with new.
: s/old/new/g-Replaces all old on the current line with new.
: n1,n2s/old/new/g-replace file with new N1 line to all old of N2 line.
:%s/old/new/g-Replaces all old in the file with new.
5. Copy yy or Y to copy the entire line of text.
y$ is copied from the cursor's current position to the end of the line.
The y0 is copied from the current position of the cursor to the beginning.
y1g or Ygg copies all lines above the cursor.
YG copies all lines below the cursor.
Combining keys, we use GG to reach the file YG to copy the entire file, i.e. Ggyg or Gygg.

Vim shortcut (simple version)

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.