How to use Linux vim

Source: Internet
Author: User
Tags delete key save file

Vim has the ability to edit the program, can be active in font color to identify the correctness of the grammar, convenient programming.

Here is the vim of the keyboard diagram, or very detailed


Use of Vim

It is basically divided into three modes, which are command mode, insert mode and bottom line mode. These three roles are:

Command mode:

The user has just started vim and has entered the command mode.

In this state, the keystrokes are recognized by VIM as commands rather than as input characters. For example, when we press I, and I do not enter a character, I is treated as a command.

Here are a few common commands:

I switch to insert mode to enter characters

X Delete the character at the current cursor location

: Switch to Baseline command mode to enter commands at the bottom of the line


If you want to edit text: Start vim, go to command mode, press I, switch to input mode

Command mode has only some of the most basic commands, so still rely on the bottom line command mode to enter more commands


Input mode

Input I into input mode in command mode

The keys that can be used in the re-input mode are:


Character keys and shift combinations, enter characters

Enter, enter, line break

Back SPACE, backspace key, delete the previous character of the cursor

DEL, delete key, delete cursor after one character

Arrow keys, moving the cursor in text

Page Up/page down, up/down page

ESC, exit input mode, switch to command mode


Baseline Command mode

Press (:) in command mode to enter the baseline command mode

The bottom line command mode can enter single or multiple character commands, and many commands are available.

In the baseline command mode, the basic commands are:

Q Exit Program,

W Save File


Press the ESC key to exit Command mode at any time

A simple summary of the three purposes of the picture:


In use, the number is very meaningful, the number is usually meant to repeat the meaning of several times, it may be representative to the meaning of what the first, for example: to delete 20 rows, then use (20DD). If you move down 20 lines, it is (20j) or (20↓).


How to use Linux 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.