Linux--vi, VIM editor command base __linux

Source: Internet
Author: User

VI is a command-line interface under the text Editing tool, Vim is an enhanced version of VI.

Vim or VI commands can start the VIM editor
Vim + Destination file path Open file with vim
If the destination file exists, Vim opens the file
If the destination file does not exist, VIM creates the new file and opens the

VI of the three types of models:
1. Command mode (normal mode)
Pressing the ESC key in any mode will return command mode. In command mode, you can select, copy, paste, undo, and so on by typing different commands.
2. Insert mode
Press "i" in command mode to enter insert mode, you can enter edit text content in insert mode, and press ESC to return to command mode.
3, ex Mode
Press the ":" Key in command mode to enter ex mode, in ex mode to save, modify, and exit Vim.

Command mode:
I insert text before the cursor
o Insert a new row below the current line
DD Deletes entire row
YY put the contents of the current row into a buffer (copy the current row)
P Put the contents of the buffer behind the cursor (paste)
Number yy copy n rows
R replaces the current character (press R first, then press the new character to replace)
U Undo Last Action
/keyword Lookup keyword (press n key to switch back and forth between these keywords found)

Ex mode:
W Save current changes
Q exit
Q. Force exit, do not save any changes
Wq first Save and then exit
X Save and exit
Set Nu/set number shows line numbers
。 System command executes a system command and displays the result
SH switch to the command line, and then press CTRL + D to return to 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.