7.1 Vim Editor

Source: Internet
Author: User
Tags exit in

7.1 Vim Editor


Text editor, word processor

Ascii


Vi:visual Interface

Vim:vi improved


Full screen editor, modal editor


Vim mode

Edit mode (Command mode)

Input mode

Last-line mode


Mode conversion:



Edit mode--------------------> Input mode

I: Switch to input mode before the current cursor character

A: After the current cursor character, switch to input mode

O: Below the current cursor line, create a new row and switch to input mode


I: Converted to input mode at the beginning of the line at which the cursor is currently located

A: At the end of the line where the current cursor is located, convert to input mode

O: At the top of the current cursor line, create a new row and switch to input mode


Input mode--------------------> Edit mode

Esc


Edit Mode--------------------> last-line mode

:


Last-line mode 10d


Last-line mode--------------------> Edit mode

ESC (may need to be tapped)


First, open the file

#vim/path/to/somefile

Vim +# Inittab directly to line 12

Vim + Inittab The bottom of the entire file

Vim +/pattrern: Open the file and navigate to the first time that the pattern is matched to the

Beginning of Line

Default in edit mode


Second, close the file

Closing a file in the last-line mode

: Q exit

: Wq Save and exit

: q! Do not save and exit

: W Save

: w! Forcibly saved (administrator)

: Wq--X


2 Exit in edit mode

ZZ: Save and exit


Third, move the cursor (edit mode)

1 character-by-word movement

H: Left

L Right

J Down

K On


#h: Moving a # character


2 move by word

W: Move to the beginning of the next word

E: Jumps to the ending of the current or next word

B: Jump to the beginning of the current or previous word


#w:


3 in-line jump:

0: The absolute beginning

^: first non-whitespace character at the beginning of a line

$: absolute end of line


4 inline jump

#G: Jump To Line #

G: Last line


In the last line mode, directly to the travel number can be


Four, turn the screen

Ctrl + F: flip one screen down

Ctrl + B: turn up one screen


Ctrl + D: Flip down half screen

Ctrl + u: Flip up half screen


V. Delete a single character

X: Delete a single character at the cursor location

#x: Remove the total # characters from the cursor and backwards


Vi. Delete command: D

The D command is used in combination with the jump command

#dw #de #db


DD: Delete cursor in the row

#dd: Delete the # line including the line where the current cursor is located


In the last line mode:

STARTADD,ENDADDD 1,8d

.: Indicates when the forward

$: Last line

+#: Down # line

$-2:


Seven Paste command p

P: If you delete or copy the entire line, paste it above the line where the cursor is located,

If the copied or deleted content is a non-full row, paste to the front of the character where the cursor is located

P: If the entire line is deleted or copied, paste it below the line where the cursor is located.

If the copied or deleted content is a non-full row, paste to the back of the character where the cursor is located


Eight, copy command y

Usage with d command


Nine, modify: first delete the content and then convert to input mode

C: Usage with d command


X. Replacement: R

R: Replacement mode

ESC Exits replacement mode


Xi. undo Edit Operation U

U: Undo Previous Edit Operation

Continuous U-command to undo previous N Edit operations

#u: Undo Recent # edits directly


Undo the last Undo operation: Ctrl+r


12. Repeat the previous edit operation

.


13. Visualization Mode

V: Select by character

V: Select by rectangle


14. Find

/pattern

? PATTERN looks from the current cursor to the file header

N

N


XV, find and replace

Using the S command in the last-line mode is the same as SED

Addr1,[email Protected]@[email protected]

I (ignoring case)

:., $-1s/he/he/g

1,$

%: Indicates full-text lookup


7.1 Vim 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.