VIM basic Commands

Source: Internet
Author: User
Tags save file

Vim enters vim on the command line and goes to the VIM editor
I press the I key and the lower end shows the--insert--insert command
ESC exit I (insert) command for other commands to use

: R file name reads into a file content and writes to the current editor

: W New file name the contents of the editor are written to a new file

: W saves the file in the process of editing, equivalent to ctrl+s in Word

:! command to temporarily leave VI to command column mode to execute the display results of the commands! For example:!ls: Execute shell command in the editing process LS
: Wq save file and exit, or ZZ (note uppercase)

: q! Force quit, do not save

: Set number causes the file in the edit to display line numbers (or: Set Nu): Set Nonumber or: Set Nonu, in contrast, do not display line numbers
: Help i view insert command assistance

U Undo Previous Action

/fedora Find Fedora characters

: S/fedora/redhat replaces Fedora characters with Redhat (replaces only the line where the cursor is located)

DW Delete Word

DD Delete Row

o Open a blank line

Vim + filename To edit the last line of the file

Vim +n file name to enter the nth line of files for editing

: 1,.s/redhat/fedora. Indicates the current line, which is the row of the cursor, and line 1th to the current line (.) The first occurrence of the redhat character instead of the Fedora

: 1,.s/redhat/fedora/g the 1th line to the current line (.) All occurrences of redhat characters instead of Fedora,g

: 1, $s/redhat/fedora/g $ represents the last line, substituting the 1th line to the last line for all occurrences of redhat characters as Fedora or (:%s/redhat/fedora/g)

:%s/\/fedora/g the Redhat word from line 1th to the last line instead of the Fedora Word, not the character!

: F Display file contents, status, etc., with ctrl+g command

: e! Current file, returning to last saved

: E File Toggle Edit files

: N switches to the next file when editing with multiple files (such as Vim file1 file2), in conjunction with: E file

VIM basic 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.