Linux vi vim text editor

Source: Internet
Author: User

Vim is a reinforced version of VI, it is recommended to use VIM.

Vim has three different modes:

Command mode (normal mode)

After Vim starts, it enters command mode by default, and any mode can be returned to command mode by ESC. Command mode can be done by typing different commands to complete the selection, copy, paste, undo and so on.

Insert Mode

Type the i key in the command mode to enter insert mode, edit the text content in insert mode, and use ESC to return to command mode.

ex Mode

Type in command mode: You can enter the EX mode and the cursor will move to the bottom, where you can save the changes or exit vim.

Command mode common commands

I insert text before the cursor

o Insert a new row below the current line

DD Delete entire row

YY puts the contents of the current row into a buffer

N+yy the contents of n rows into a buffer

P Paste the text of the buffer into the cursor

U Undo Previous Action

R replaces the current character

/Find Keywords

n switches back and forth between keywords after a keyword is found

ex mode Command

: W Save current changes

: Q exit

: q! Forced exit

: x save and exit, equivalent to: Wq

: Set number Displays line numbers

: SH switch to command line, use Ctrl+d to switch back to vim

Linux vi vim text editor

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.