Getting started with linux (2) Vim & amp; vi basic operations

Source: Internet
Author: User

Vi/Vim

Picture copyright: lampbrother

Note: After Entering Vim/Vi, the command mode is used by default.

 

1) Basic commands

 

AAdd text behind the cursor

 

IInsert text before the cursor

 

: WqSave changes and exit

 

ZZShortcut Key, save the modification and exit

 

: Q!Exit Without saving changes

 

: WSave changes

 

 

2) basic operations

UCancel the previous operation


Ctrl + r 
Restore the Undo operation in the previous step

: Set nuSet row number

: Set nonuCancel row number

 

GgTo the first line

GTo the last line

: NTo row n

Clear Screen

A. First, execute gg to jump to the first line of the file.

B. Run the following command: dG.

 3) Advanced Operations

Start split screen

A.Use uppercase O parameters for Vertical Split screen

$ Vim-On file1file2...

B.Use lower-case o parameters for horizontal split screen

$ Vim-on file1file2...

Note:N is a number, indicating the number of split screens

 

C.To switch between screens, just press ctrl + w.

 

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.