[Study notes] basic Linux operations (6) --- Vi text editor

Source: Internet
Author: User
Course connection: Vi text editor vi and vim introduction vi is a text editing tool on the command line interface. it has functions such as text editing, text processing, and code development.

Course connection: Vi text editor

Vi and vim

Vi is a text editing tool on the command line interface. It provides text editing, text processing, code development, and other functions.

Vim is from vi ?? Strong edition (code highlighting)

Run vim to start the vim editor.

Vim + target path

If the file exists, open the file. if the file does not exist, create the file.

Vim three modes-command mode

After vim is started, it enters the command mode by default. in any mode, the command mode can be returned through the esc key. In command mode, you can copy, paste, select, and revoke commands.
-In the insert mode, press 'I in the command mode to enter the insert mode. in the insert mode, you can enter the edit content and press esc to return to the command mode.
-In the command mode, press the ':' key in the quiet mode. the cursor moves to the bottom. you can save or exit vim here.

Command mode
I insert o in front of the cursor insert dd in the next row of the current row delete the current row yy put the current row into the buffer (copy the current row) n + yy put n lines of content into the buffer (copy the current n rows) p paste the content in the buffer after the cursor u undo r replace the current character/search keyword (n key switch)

EX Mode: w save: q exit: q! Force exit, do not save changes: x save and exit, equivalent to: wq: set number display row number :! The system command executes a system command and displays the result: sh switches to the command line, Ctrl + d returns vim

Insert mode

After pressing 'I', you can enter any text, and esc will exit the return command mode.


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.