Linux (5) -- VI/VIM Editor, -- vivim

Source: Internet
Author: User

Linux (5) -- VI/VIM Editor, -- vivim

After all, we can't do without editing files. In Linux, we usually use VI/VIM to edit files. VI is a text editor that comes with Linux. VIM is an enhanced version of VI. Some release versions may not come with it. You can use the sudo apt-get install vim command to install vim.

You can use the vi or vim command to directly enter a new text file, or use the vim file name to open the file for editing.

The interface is different from the command line interface:

At this time, you may not be very sensitive to input, because there are three modes in vi. Only the insert mode can be inserted and deleted as you would in the windows text editor. The three modes are described as follows:

1-command mode (default mode. In any form, pressing esc enters the command mode. In this mode, only commands are received. In this mode, you can select, copy, paste, undo, and other traditional operations. 2-insert mode (can be output freely) press the I key in command mode to enter insert mode. In this mode, you can enter and edit the text content. 3-in operating command mode such as saving and exiting files in ex mode, press: to enter (shift + may be required) in addition to entering and editing in the insert mode, the other two modes also have corresponding command operations: Common commands in the command mode: I insert text before the cursor o Insert a new line dd under the current row Delete the current row yy put the content of the current row into the buffer (copy the current row) n + yy copy n rows of content p paste the cached text to the cursor u undo the previous operation r replace the current character/key search keyword (key) then press the n key to switch the key word EX mode. Common command: w to save the current modification: q to exit: q! Force exit, do not save changes: x save and exit, equivalent to: wq: set number display row number :! Execute a system command and display the result: sh switches to the command line, and press ctrl + d to switch back to vi.

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.