VI/VIM editor and vivim Editor

Source: Internet
Author: User

VI/VIM editor and vivim Editor
1 Overview

All Unix Like systems have built-in vi file editors, while other file editors do not necessarily exist. However, we currently use the vim editor.

Vim has the ability to edit programs. It can actively identify the correctness of the syntax in the font color to facilitate program design. Vim is a text editor developed from vi. Code Completion, compilation, error jump, and other convenient programming functions are particularly rich and widely used by programmers.

To put it simply, vi is an old-fashioned word processor, but its functions are quite complete, but there is still something that can be improved. Vim is a useful tool for program developers. Even vim's official website (http://www.vim.org) itself says vim is a programming tool rather than a text processing software.

2 normal mode

Open an archive in vi and enter the normal mode (this is the default mode ). In this mode, you can use the top, bottom, and left buttons to move the cursor. You can use the delete character or delete the entire line to process the file content, you can also use "copy and paste" to process your file data.

Common syntax

1) yy (Function Description: copy the current row of the cursor)

Y number y (Function Description: copy a segment (from row to row ))

2) p (Function Description: Move the arrow to the target row and paste it)

3) u (Function Description: undo the previous step)

4) dd (Function Description: Delete the current row of the cursor)

D Number d (Function Description: How many rows after deleting the cursor (inclusive)

5) x (Function Description: delete a letter, equivalent to del)

X (Function Description: delete a letter, which is equivalent to Backspace)

6) yw (Function Description: copy a word)

7) dw (Function Description: delete a word)

8) shift + ^ (Function Description: Move to the line header)

9) shift + $ (Function Description: Move to the end of the row)

10) 1 + shift + g (Function Description: Move to the page header, number)

11) shift + g (Function Description: Move to the end of the page)

12) number N + shift + g (Function Description: Move to target row)

3. editing mode

In normal mode, you can delete, copy, and paste files, but you cannot edit the file content! It takes you to press "I, I, o, O, a, A, r, R" and other letters to enter the editing mode.

Note! In Linux, when you press these buttons, "INSERT or REPLACE" appears in the lower left corner of the screen before editing. To return to normal mode, you must press the "Esc" button to exit the editing mode.

Common syntax

1) enter the editing mode

(1) I before the current cursor

(2) After a's current cursor

(3) o the next row of the current cursor row

2) Exit the editing mode.

Press Esc.

4. Command mode

In normal mode, enter 『:/?』 Any of the three buttons can move the cursor to the bottom line.

In this mode, you can search for information, and read, save, replace a large number of characters, exit vi, display row number, and other actions are achieved in this mode!

Common syntax

1) basic syntax

(1): Option

W save

Q exit

! Exclamation point Force Execution

(2)/search,/word to be searched, n is to find the next word, shift + n is to search up

(3 )? Search ,? The word to be searched. n indicates the last word to be searched, and shift + n indicates the next word to be searched.

2) Cases

: Wq! Force save and exit

 

 

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.