Vim editor Visual Interface improved full screen editor

Source: Internet
Author: User
Tags exit in

Vim mode:

1. Command mode (edit mode)

2. Input mode

3, the last line mode

Mode conversion

Edit mode--Input mode

I: Inserts a character before the current cursor character

A: Inserts a character after the current cursor character

O: Inserts a character below the line of the character where the current cursor is located

I: The beginning of the line

A: End of line

O: Insert a new row above

Input mode--edit mode

Esc

Edit Mode--last-line mode

Input:

Last-line mode--edit mode

Esc

First, open the file

#vim +n file to open files, position on nth row

#vim + file to open files and locate the last line

#vim +/pattern Open the file and navigate to the beginning of the first match

Second, close the file

1. Close the file in the last line mode

Q Do not save exit

wq/x Save and exit

Q! Do not save forced exit

W Save

W! Forcibly saved

2. Exit in edit mode

ZZ Save Exit

Third, move the cursor ( edit mode )

1, character-by-character movement (support numbers with the following keys, moving the number of characters n+h key)

H Right

L Left

J Down

K Up

2. Move in words (Support number plus following key, N+w key)

W moves to the beginning of the next word

E jumps to the ending of the current or next word

b jumps to the beginning of the current or previous word

3, in-line jump

0: The absolute beginning

^: first non-empty white space character at the beginning of a line

$: absolute end of line

4. Jump between rows

n+g: Jump to Nth line

G: Last line of text

GG: First line of text

Four, turn the screen

1. Ctrl+f: Turn down one screen

2. Ctrl+b: Turn up one screen

3, Ctrl+d: Turn down half screen

4, Ctrl+u: Turn up half screen

Five, delete a single character (support number plus the following key, N+x key)

X: Delete the single character where the cursor is located

Vi. Delete command: D (Command mode)

d command combined with jump command d+w

#d, #de, #db, #d $, #d0

DD: Delete cursor in the row

Nd: down n rows, including the cursor row, are deleted

In the last line mode: STARTADD,ENDADDD

.: Indicates when the forward

$: Indicates the last line

+n: N-Line down

Seven, paste command: P

P: If you delete or copy to an entire line, paste to the bottom of the line where the cursor is located, and if the deleted or copied content is a non-full row, paste it after the character that contains the cursor

P: If you delete or copy to an entire row, paste to the top of the line where the cursor is located, and paste to the front of the character where the cursor is located if the deleted or copied content is not a whole line

Viii. Copy command: Y

Same as delete command D usage

Nine, modify: First delete the content, and then converted to input mode C

Same as delete command D usage

X. Replacement: R

R: Single character substitution

R: Replace mode ESC exit

Xi. undo Edit Operation U

U: Undo Previous Edit Operation

The continuous u command can undo previous N edit operations

N+u: Undo the last N edit operation directly

Undo last Undo Operation: Ctrl+r

12. Repeat the previous edit operation.

. Period: Repeats the previous action command

13, the visual mode of V

V: Select by character

V: Select by rectangle

14. Find

/pattern down

? PATTERN up

N

N

XV, find and replace (last-line mode)

Addr1,addr3s/pattern/string/g|i

%: Full text

16. Open multiple Files with vim

Vim file1 file2 File3

Last-line mode: Next switches to the next file

: Prev Switch Previous file

: Last switch to final file

: first to switch to file one

Exit QA All Exit

17, split screen display a file

Ctrl+w,s Horizontal split screen: Split

Crtl+w,v Vertical split screen: vsplit

Toggle the cursor between windows

Ctrl+w,arrow

18, sub-Windows multiple files

Vim-o Horizontal split Screen display

Vim-o Vertical split Screen display

19. Save some of the contents of the current file as a different file

Use the W command in the last row mode

Save within specified ·

Addr1,addr2w/path/to/somewhere

20. Populate the contents of another file in the current file

: R/path/to/somefile

21. Interacting with the shell

:! COMMAND

22, advanced settings (last line mode)

1. Display or suppress line numbers

Set number \ Set Nu

Set Nonu

2. Display ignores or distinguishes character case

Set IGNORECAE \ Set IC

Set Noic

3. Set Auto Indent

Set autoident \ Set AI

Set Noai

4. Check the found text highlighting or canceling

Set Hlsearch

Set Nohlsearch

5. Syntax highlighting or canceling

Syntax on

Syntax off

6. Set the number of tab-forward spaces

Set tabstop=4 or ts=4 tab space length

23. Configuration Files

/ETC/VIMRC (Global All users)

~/.VIMRC (Current user)


Vim editor Visual Interface improved full screen 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.