Linux Commands 5

Source: Internet
Author: User

[email protected] ~]# which vim
/usr/bin/vim

[Email protected] ~]# RPM-QF ' which vim '
Vim-enhanced-7.2.411-1.8.el6.x86_64

First entry to file: Command mode

Input: Indicates command-line mode

Insert: Edit mode appears

Switch to command mode input ":"

Switch to edit mode enter "a I o"

How do I switch from edit mode to command line mode?

Edit mode "ESC" Command mode: "Command line Mode"

x Delete one character backwards equals delete X forward delete one character U undo one step and undo it once per press

Jumps to the beginning of the end of the line home key or ^ start $ or END key line end

Splicing and pasting

DD splicing a line of numbers +DD splicing multiple lines

YY Copy line number +YY copy n rows

Copy 3 lines, using 3yy

P Paste the Copy line

Delete to the beginning of d+home or ^ (shift+6)

Delete to end of line d+end or $ (shift+d)

W Toggle Word

DW Deletes a word that is removed to move the cursor to the beginning of the word. If the cursor is not at the beginning of the line, delete the letter after the cursor.

YW copy a word

Block operation

D or d+$ Delete to end of line d+^ Delete to beginning y+$ Copy to end of line y+^ copy to beginning

The comment information in the script, how to add the comment symbol in bulk?

Enter the VI mode to move the cursor selection area;

Multiple lines of annotation are required for programming

1. Note: Ctrl + V enters edit mode

2. Move the cursor down or up

3. Mark the beginning of the line to be annotated

4, then press the uppercase I

5. Insert the comment symbol, for example: "#"

6. Press ESC again, and it will all be commented out.

Delete a multiline comment: Press CTRL + V to enter edit mode, move the cursor down or up, select the comment section, and then press D to delete the comment symbol.

Vim command line mode operation

: W Saves Save

: Q did not make any changes, quit. Quit

: q! Modified, not saved, forced to quit

: Wq Save and exit or ZZ

: wq! Force Save and exit

Set Nu #显示行号

Set Nonu #不显示行号

/forward Lookup:/san n looks down, N looks up

: Noh #取消高量显示

Navigate to a row in vim

GG positioning to the beginning of the line

G navigates to the last row, beginning of line

#G Navigate to a row

#gg Navigate to a row such as: 3gg

Linux Commands 5

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.