Three modes of the VIM editor

Source: Internet
Author: User

Vim650) this.width=650; "class=" Selectsearch-hide "id=" Selectsearch-icon "alt=" search "src=" http://img.baidu.com/img/ Iknow/qb/select-search.png "/> Editor can basically be divided into 3 modes, namely command mode, insert mode and bottom-line mode (last Shown is a diagram of the various modes of vim that are converted to each other.

Command mode: Control the movement of the screen cursor, the deletion of text, copying and other text editing work (do not use the [Del] and [Backspace] keys) and into the insertion mode, or back to the bottom line mode.

Insert mode: You can enter text only in insert mode. Press the [ESC] key to return to the command line mode. Many vim editor users want to enter content as soon as they open vim, but this is not successful because the VIM editor is just opened in command mode.

Bottom-line mode: Save the file or exit Vim, and also set the editing environment and some compilation work, such as listing line numbers, looking for strings, etc.

In some books, the Vim editor is simplified into two modes, and the bottom line mode is counted as the command line mode.

650) this.width=650; "class=" ikqb_img "src=" http://f.hiphotos.baidu.com/zhidao/wh%3D600%2C800/sign= Af095bb51e178a82ce6977a6c6335fb5/c83d70cf3bc79f3dd5f34549baa1cd11728b29bc.jpg "alt=" C83D70CF3BC79F3DD5F34549BAA1CD11728B29BC "/>

When opened, the default entry is the command mode, in the command mode to enter the i,a,o of any one letter can enter the insertion mode, press ESC to return to command mode, in command mode, enter a colon to enter the bottom line mode. The insert mode and the bottom row mode cannot be converted to each other, and you need to return to the command mode before conversion.

    1. Use regular expressions in bottom-row mode:%s/[\t]*\d\{1,4\}/, you can remove the number before each line and the characters and spaces before the number.

: 1,315s/^\s*[0-9]*\s*//g

Explanation: 1 is the starting line number, 315 is the ending line number, ^ in the regular in the beginning, \s* represents a number of spaces, can not, [0-9]* represents a number of numbers, can not, will ^\s*[0-9]*\s* replaced with nothing.


2. Indent the code using the following methods:

GG jumps to the beginning of the line

V into visual mode

G jump to end of line

= Indent the selected line (all rows are selected here)

All the code is properly indented.


Three modes of the VIM editor

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.