The basics of using VIM

Source: Internet
Author: User
Tags save file

The Vim tool on the Linux platform can be said to be very well known and powerful, so this tool has to be said!

Use the command vi file name directly to create and edit the file.

Three modes of VIM:

Command mode;

Insert mode:

Bottom line mode;

The default entry is command mode. In command mode we can enter a number of commands, here are some common commands:

Ctrl+b back Page

Ctrl+f Page Forward

0 move the cursor to the beginning of the line

$ moves the cursor to the end of the line

G move the cursor to the end of the file

1G move the cursor to the top of the file

N G move the cursor to the [n] Line

[n]+ moves the cursor down [n] Lines

[n]-moves the cursor up [n] Lines

X Delete the character at the cursor position

DD Delete the line where the cursor is located

[N]dd deletes the row and the following [n] lines of the cursor

YY copy when moving forward

[N]yy Copy the current line and the next [n] Line

P Paste

U Redo Last Action

/Find content Cursor search backwards

? Find content Cursor forward lookup

N Continue looking down

Command mode switch to insert mode: Key I,a,o

Insert mode Toggle Command mode ESC key

Command mode input: Enter the bottom row mode (some bottom line mode command)

: W Save

: Q exit

: q! Force exit, do not save file

: Wq save File and exit

: W file name to save the file as the filename

: Set NU Displays line number

: Set Nonu suppress line numbers

These are only a small part of the Vim tool, but for beginners, these commands are sufficient. More advanced commands can be found in the official manual, which is detailed in the description.

The basics of using 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.