Vim Learning Notes

Source: Internet
Author: User

Turned out a long time ago written by Vimnote.txt

"Vim Practical Skills" This book has been read from beginning to end two or three times, because the memory is too bad, wrote this document to record some common instructions, use ripe later to explore some more powerful features

Vim has been used frequently since the recent move to Linux, hoping to master it as soon as possible

Vimnote.txt:

CTRL-W s Horizontal split screen
Ctrl-w v Vertical split screen
Ctrl-w r Rotate Window position
--------------------------
I Line Header Insertion
A Line End Insertion
F in-line search
F in-line reverse lookup
; Next in line
, in-line previous
* Next The word
# Previous Word
N Next
N Previous
Y copy
D Delete
C Change
Gu variable lowercase
GU to uppercase
~ Invert case
T till
T Anti-till
/Backward Lookup
? Search forward
s deletes the current character and enters insert mode
S deletes the entire row and inserts
C-a Add a number (the cursor is not automatically moved to the first digit when it is not on the number)
C-x Decrease the number (the cursor is not automatically moved to the first digit when it is not on a number)
C-w Delete the previous word in insert mode
C-u Delete an entire row in insert mode
C-r Call Register
C-r = call Operation Register
C-r 0 Insert mode paste (register 0)

--------------------------
^ First non-null character to beginning of line
GG jumps to the first line
W Next word Header
E Next word End

--------------------------
YY copy when moving forward
: Noh Cancel Search highlighting
Delete blank line:: g/^\s*$/d
Full-text auto indent: gg=g

--------------------------
L Letter
W Word
S Sentense
P Paragraph
Block B
--------------------------
M{A-Z}: Local tag, only for current file
M{A-Z}: Global tag. Restart Vim, Mark still valid
' A jump to mark a
--------------------------
: S/old/new-Replaces the first old of the current row with new
: s/old/new/g-Replaces all old of the current line with new
: n1,n2s/old/new/g-replace file with new N1 line to N2 all old
:%s/old/new/g-Replaces all old in the file with new
:%s/^/xxx/g-Insert xxx,^ at the beginning of each line to indicate the beginning of a row
:%s/$/xxx/g-Insert xxx,$ at the end of each line to indicate end of line
------------------------------------
QA: Start Recording Macro A
Q: Stop Recording
@a: Play Macro A
--------------------------
GD: Jump to the definition of a local variable
GD: Jump to the definition of a global variable and start searching from the beginning of the current file
CI (, Di (, Yi (: Modify, cut, or copy content between ()
CA (, Da (, ya (: Modify, cut, or copy content between (), contains ()
--------------------------
Simple calculator: In insert mode, enter C-r =, and then enter the expression, you can get the calculation results at the cursor
--------------------------
ZZ: Move the current line to the center of the screen
ZT: Move the current line to the top of the screen
ZB: Moves the current line to the bottom of the screen
Ctrl+f: Turn down one screen
CTRL+B: Flip One screen
Ctrl+d: Lower turn half screen
Ctrl+u: Flip Half screen
Ctrl+e: Scroll down one line
Ctrl+y: Scrolls up one line
n%: location to File n%
--------------------------
Command-line mode:
% selected Full text
1 First line
0 Line 0th (non-existent virtual row)
. Cursor is in the row
' < The start row of the selected area
' > The end row of the selected area

Example
:%normal i//Comment Full text
:%normal A; Full text trailing plus semicolon
:%normal. Full-text execution. (Repeat command)

TAB forward Completion
S-tab Reverse complement
c-d Prompt for all options

Vim Learning Notes

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.