Vim Usage Tips Summary

Source: Internet
Author: User

Vim's browsing

Full page Flip Ctrl-f ctrl-b
F is forword B is backward

Turn Half page
Ctrl-d Ctlr-u
D=down U=up

Roll one line
CTRL-E ctrl-y

ZZ allows the cursor to reside in the center of the screen.
ZT keeps the cursor on the top row of the screen t=top
ZB let the cursor reside on the bottom row of the screen B=bottom

Open one more file: E <filename>

Switching between files: bn (next file), BP (previous file)

(Multi-window)

Cursor movement

Move to the beginning of the line: 0

Move to the first non-blank character of a line: ^

Move to end of line: $

W selects the first word of the word, E selects the trailing word of the word, and W selects the first word of the word, and GE chooses the trailing word of the word.

F<char> backward searches for letters followed by F, (semicolon) for repeating backward search actions, (comma) for repeating forward search actions

Move to the first line: GG

Move to the last line: G

Move to Nth row: NG

To match the movement of large small brackets:%

Match the movement of the word with the cursor: * (match next), # (Match previous)

Insert mode

Insert before cursor: I

Insert after cursor: a

Insert a row after the current line: O

Insert a row before the current line: O

Vim Text manipulation

Repeat the previous command:. (period, repeat n times, output n.)

The command that is preceded by a number and can be repeated a given number of times

Copy starting at cursor: Y

Paste after current position: P (previously capitalized p)

Block selection operation

<action>a<object>And<action>i<object>

A means including object,i that does not include object

    • The action can be any command, such as d (delete), ( y copy), v (can be selected depending on the mode).
    • The object may be: w A word, W a word separated by a space, a word, a s p paragraph. It can also be a special character: "、 ‘、 )、 }、]。

Auto Completion: Ctrl+p or CTRL + N

Block operations, typical operations:0 <C-v> <C-d> I-- [ESC]

    • ^→ to Wardrobe
    • <C-v>→ Start block operation
    • <C-d>→ Move down (you can also use HJKL to move the cursor, or use%, or something else)
    • I-- [ESC]→i is inserted, insert " -- ", press ESC to take effect for each line.

Under Windows Vim, you need to use <C-q> instead <C-v> of copy the <C-v> Clipboard.

Add something after all the selected lines:

    • <C-v>
    • Select the relevant line (you can use or or ... j <C-d> /pattern % )
    • $To the end of the line
    • A, enter a string, pressESC。

Search and replace

http://tanqisen.github.io/blog/2013/01/13/vim-search-replace-regex/

Set Hlsearch "Open highlight Search

Set Nohlsearch "Close highlight Search
Nohl "Only remove the current search highlighting

Vim Usage Tips Summary

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.