Vim Text Editor

Source: Internet
Author: User
Tags exit in

Text Editor: Word processor

Vim:visual Interface Improved

Full screen editor, modal editor
Vim mode
Edit mode (Command mode)
Input mode
Last-line mode

Mode conversion:
Edit-Input
I: In front of the character where the current cursor is located, convert to input mode;
A: After the character of the current cursor, convert to input mode;
O: Create a new row below the current cursor line, and convert to input mode;

I: At the beginning of the current cursor, converted to input mode;
A: At the end of the line at which the cursor is currently located, convert to input mode;
O: At the top of the current cursor line, create a new row and convert to input mode;

Input--Edit
Esc

Edit-to-last line

Last line--edit
ESC may be multiple times

First, open the file
#vim/pass/to/somefile

Vim +n somefile direct to Nth line
Vim + somefile directly to the last line of the file
Vim +/pattern: Opens the file, navigates to the beginning of the first PATTERN match to

Second, close the file

1. End-of-line mode close file

: Q exit
: Wq Save and exit
: q! Do not save exit
: W Save
: w! Force Save
: 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: Next
K: Up
#h: Move a specified number of characters

2. Move words one by one
W: Indicates the first word moved to the next word;
e: Represents the ending of moving to the current word or the next word;
B: Indicates the first word moved to the current word or the previous word;

#w: #个单词

3, in-line jump:
0: Beginning of the line, absolute beginning;
^: first non-whitespace character at the beginning of a line
$: Absolute line end;


4. Jump between rows
#G: Jump directly to Line #
G: Jumps to the last line;

in the last line mode, directly to the travel number can be
  
Four, turn screen operation
Ctrl + F down
Ctrl + B up

Ctrl + D: Flip down half screen
Ctrl + U: Flip up half screen

Five: Delete a single character
x: Delete the single character where the cursor is located
#x: Delete The total # of characters that are located backwards in the cursor

Six: Delete command: D command combined with jump command
D0
d$
DW
de
DB
3DW
#d跳转符: Remove the # characters from the jump range
DD
#dd: Delete the # line including the cursor line
In the last line mode:
: 1,8d
:., 100d current line to 100 rows
:., +10d current line down 10 rows
.: Current Row
$: Last line
+#: Down # line
-#: Up # line;

the deleted content is saved in the buffer, and the last deleted content can be copied to the cursor location;

seven, paste command p
P: If the entire row is deleted or copied, paste it below the row, or if the copied or deleted content is a non-full row
is pasted to the following line of the standard;
P: If the entire row is deleted or copied, paste it above the row, or if the copied or deleted content is a non-full row
is pasted in front of the line of the standard;

Eight, copy command y
y command with d command

Nine, first delete the content and then convert to input mode
C with d command to modify command

10. Replace: R Replace
R: Replace single character under current cursor, r+ need to be replaced by character
R: Enter replacement mode

11. Undo Edit Operation U
u: Undo the previous edit operation, you can undo the previous n<50 operation;
#u: Directly undo the previous # edit operation;
Restore the most recent undo operation: Ctrl+r

12. Repeat the previous edit operation
.

13. Visualization Mode
V: Select by character
V: Select entire row by rectangular block
Then the D P y operation is performed;

14. Find
/pattern search from the first tail
? PATTERN looks from tail to header
N Jump Down
N Jump Up

XV, find and replace
Use the S command as in last-line mode as the SED command
Addr1,[email Protected]@[email protected]
From the current line to the penultimate line he replaces the he:., $-1s/he/he/g

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.