Some uses of vim

Source: Internet
Author: User

HJKL Lower left upper right
B/b move forward one word
w/w Move backward One word
e/e Move backward One word
0 move to the first non-empty letter
^ Move to the beginning of the line

$ move to end of line


i/i Insert
CC/C Change
O/O inserts a blank line in the next/previous line and starts editing
R/R Replace
S/S substitude
A/A Append


~ Convert case
D/DD/D Delete
x/x Delete Current/pre-cursor characters
p/p Place the contents of the buffer behind/before the cursor
y/yy/y Copy Text
. Repeat Last Command
U/u Undo
Ctrl+r Redo
J merge two rows into one line


(command) (number) (Text object)
(number) (command) (Text object)


command editing commands, such as C,d,y,
Text Object Move command, such as W,e
4DD, D4W, 5w, 2yy, D/info


Ctrl+f back screen (forward)
Ctrl+b Front flip screen (backward)
Ctrl+d back half screen (down)
Ctrl+u forward half screen (up)


Shift+g to the last line


Z Enter to place the current line at the top of the screen
Z. Place the current line in the middle of the screen
Z put the current line at the bottom of the screen


The NH cursor moves to the top of the screen
M cursor moves to the middle of the screen
NL cursor moves to the bottom of the screen
GG cursor moves to the beginning of the first line of the screen


+/enter move to the beginning of the next line
-Move to the beginning of the previous line


(/) Move to the beginning of the sentence/end of sentence (with.!? Wait for the separation.)
{/} moves to the end of the segment (separated by a blank line)
[[/]] move to the beginning/end of the chapter (Troff)


G Go to (88g,145g)
Ctrl+g shows the ratio of the current line's position in the file


% move to matching parentheses


/Backward Search
? Search forward
n Repeat last Search
N repeat the previous search in the opposite direction


Vim File1.txt File2.txt


: Rew Rewind
: N Next
:p Rev Previous
: args displays a list of all files


Ctrl+6 switch to the first file


Combined with buffer
: 160,224ya A
:p u A


Vim–p file1.txt File2.txt


: Tabn/gt Next Label
: tabp/gt Previous label
: tabnew new Label
: TABC Close Current tab
: Tabo Close all other labels
: Tabs List all labels
: Tabfirst First Label
: Tablast last Label
: TABM n Moves the current tab
: Tabf/dir Search dir Open File


Display multiple files on one screen at the same time
1: Compare Files
2:copy and paste
3: Reference to other documents


VIM provides multiple windows:
Vertical or horizontal split screen


Vim-o file1 file2 by file number horizontal split screen
Vim-o5 file1 file2 divides the screen horizontally into 5 points


^w+r the position of the upper and lower window
^w+x swap the position of the left and right window

^w hjkl Move Up or down
^w hjkl Move the current window to the nearest side
: New ^ws:split Landscape
: Vnew ^wv:vsplit New Window

^w +-= Resize window up or down
^w<>| Resizing the window around
^WT Window Change tab


Some uses of vim

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.