Linux Text Processing---text compiler vim

Source: Internet
Author: User

Text editor Vim

VIM: (visual interface improved), is a full-screen plain text asscii Editor, is the enhanced version of VI, compared to VI, VIM support syntax highlighting features.

Vim is a modal editor, common patterns are edit mode (command mode), input mode, last line mode, visualization mode, multi-file mode, multi-window mode, etc.

usage:vim [option] ... [FILE] ...


I. Introduction to various Models

Edit mode (Command mode): This mode of keyboard operation is usually understood as the edit command

Input mode: User can enter text content in this mode

Last-line mode: Vim built-in command-line interface to perform vim built-in variables

Visualization mode: Users can highlight the content of text in this mode

Multi-File Mode: Users can open more than one file at a time in this mode

Multi-Window Mode: In this mode, multiple Windows can be displayed in full screen to edit the file


Second, the switch between the various modes

Mode switch Type Switching methods
Edit mode, Input mode I,a At the front of the cursor, the rear is converted into input mode
I,a At the beginning of the cursor, the end of the line is converted to input mode
O,o The next line is converted to the input mode on the row where the cursor is located
Input mode, edit mode Esc
Edit Mode--last-row mode :
Last-line mode--edit mode Esc


Iii. text Manipulation under Edit mode (Command mode)

for the trailing line of the backward file where the copy cursor is located
Operation classification Concrete method and significance
Cursor movement Move between characters J,k J: Move cursor down K: Move cursor down
Hl H: Move the cursor to the left L: Move the cursor to the right
#{h|j|k|l} 3h: Jump cursor to the left 3 characters 4j: Jump down Cursor 4 lines
Move between words W W: Cursor moves to the next word ending
E,b

E: The cursor jumps to the current or next word ending

B: Cursor jumps to the beginning of the current or previous word

#{w|e|b}

3w: Cursor jumps to the ending of the next 3 words

4b: The cursor jumps to the top of 3 or 4 (the cursor happens to be the first word)

In-line movement 0,$

0: Cursor jumps to absolute beginning

$: Cursor jumps to absolute line end

^ ^: cursor jumps to the beginning of the first non-whitespace character at the beginning of the line
Move between rows #G 5G: Jumps the cursor to the beginning of the first non-whitespace character at the beginning of line 5th
G,gg

G: Jumps the cursor to the beginning of the first non-whitespace character at the end of the line

GG: Jumps the cursor to the beginning of the first non-whitespace character at the beginning of the line

Edit command x class x, #x

x: Delete the character where the cursor is located

4X: Delete A total of 4 characters after the cursor is located and after

d class dd D #dd d#d

DD: Delete an entire line

D: Same as d$, delete all contents of the line where the cursor is located

D combined with W,e,b,^,$,0,g,gg

DGG: Delete all the contents of the cursor at the beginning of the line and at the cursor

DB: Delete the contents of the word header at the cursor at the front of the cursor

Class Y Yy,y,y#y, #yy

YY Y: The entire line where the cursor is copied

Y3Y 3yy: The copy cursor is located in the following total of 3 rows

combined with W,e,b,^,$,0,g,gg

yw: the character

y$: the character

yg: the character

p class p p

row level:

    P: Paste below Current line

    P:   Paste above current line       

Less than the line level:

    P: Paste at the rear of the current cursor

    P: Paste at the front of the current cursor

Class C CC, #c

CC C: Deletes the entire line at the cursor and enters the input mode

Used in conjunction with W,E,B,^,$,0,G,GG

CGG: Deletes all the contents of the cursor to the beginning of the file and enters the input mode

C0: Delete all content at the beginning of the cursor and enters the input mode -

Undo Edit
U, #u

U: Undo last Exercise

3u: Undo the first 3 operations

Ctrl+r Undo the last undo exercise
Repeat the previous command .
Repeat the previous command



Four, the last line mode

This article is from the "After Dark" blog, be sure to keep this source http://guoting.blog.51cto.com/8886857/1435451

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.