Vim Common commands

Source: Internet
Author: User

Have a certain VIM basis can read this article, can quickly query common commands.

Use VIM to install the following three packages

vim-minimal only provides VI and related commands
vim-enhanced provides VIM commands
vim-x11 offers Gvim

VIM has three modes: command mode, insert mode, ex mode

i→ insert mode, press ESC to return to command mode

Command mode:

X: Delete one character of the current cursor

DD: Delete the current line and save the deleted row to the Clipboard

P: Paste after current position

P: Paste before current position

YY: Copy when moving forward

U: Undo
A: Start insertion after current cursor x position (APPEND)
A: Start insertion at the end of the current line
I: Start inserting at the beginning of the current line
O: Insert above current line
O: Insert below current line
GG: Move to first line of document
G: Move to the last line of the document
R: Replace the character at the cursor
~: Change Case

Ctrl + V: block-based
Ctrl+r Recovery undo

V: Character-based
V: Row-based

Ex mode:

: X or: Wq Save and exit

: q! Exit does not save

: w!sudo Tee% forced save

: Anges/pattern/string/flags

Range can be line number, line number range, search condition (/readme\.txt/),%
The common flag is g (replacing pattern on multiple positions in a row) and I (case-sensitive using the current search)
Eg:%s/\<cat\>/dog/gi

Vimtutor VIM Manual

Vim Common commands

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.