L-1-13 Linux VIM Editor

Source: Internet
Author: User
Tags add numbers

[VI]

VI Editor Command *******************

VI <filename> Create/edit filename File

Press I to enter insert mode to edit the file.

Press ESC to exit insert mode.

: W Save

: Q exit

: Wq Save and exit

: q! Force exit (do not save)

: Set Nu Adds an asterisk to each line of the file

: Set Nonu Cancel line number

:<num> Enter a number and then press ESC, the cursor moves directly to the row header

:/<string> search for a keyword, press ' n ' to find the next

:?<string> search for a keyword, press ' n ' to find the previous


[Vim]

Vim <filename> Color-coded editing

+<num> cursor appears directly on the <num> line

+ cursor appears directly at the end of the file

+/<string> search string, the cursor appears directly in the first match place

--------------------------------------------------------

Edit mode

I enter the input mode in the position of the front of the current cursor

A enters input mode at the next position in the current cursor

o Inserts a blank line on the next line in the row where the current cursor is located

I Enter input mode at the beginning of the current cursor

A enters input mode at the end of the line at the current cursor

O insert a blank line on the previous line of the current cursor

ZZ Save, Exit editor

DD Delete a row


Move by character

H Left

L Right

J Down

K Up

Add a number to the front of the arrow key and jump to a specific number of characters.


Move by word

W The first word of the next word

E The ending of the current word, if it is already in the ending, jumps to the next word ending

b The word head of the current word, if already at the beginning of the word jump to the beginning of the previous word

You can add numbers to the front to jump a specific number of words


Moving on a row

0 jump to the beginning of the line

^ Jump to the first non-whitespace character

$ jump to end of line


Jump between rows

<num>g jump to the first <num> line

G jumps to the last line


Flip Screen

Ctrl+f Turn down one screen

Ctrl+b Turn One screen upwards

Ctrl+d Turn down half screen

Ctrl+u turn up half screen


X Delete single character at cursor location

<num>x Delete <num> characters at cursor location

d<command> and jump command combinations to remove characters from them

<num>d Delete <num> characters

DD deletes the cursor in the row

<NUM>DD Delete cursor line with line below, total <num> line


p| P recently deleted content can be pasted by P to achieve the cutting function

Y copy command, copy Content Selection rule with D

c After deleting content, go into input mode

R<string> replacing a single character

R enters replacement mode


U undo Operation

<num>u Undo <num> Secondary operations

Ctrl+r Undo Undo Action


. Repeat the previous edit operation


V Enter visualization mode and select the cursor across the content

V Enter visualization mode, select the line that the cursor passes through

# marks the word with the same word as the current cursor in the entire section.

----------------------------------------------------------------------

Input mode

ESC enters edit mode

----------------------------------------------------------------------

Last-line mode

: <num>d Delete section <num> line

: <num1,num2>d Delete section <num1>, section <num2> line

:!<shell> executing a shell command

: x equals: Wq

:<num> jump to the first <num> line

/<pattern> Find characters

?<pattern> to find from a tail line

: s/<pattern>/<string>/

Where%s can express full-text Search


Open multiple Files

: Next switches to the next file

Vim can open multiple files at the same time by default displaying the first parameter of the file.

:p Rev Switch to previous file

: Last switch to final file

: first switch to file one

: QA Exits All Files


Display a single file in a separate window

Ctrl+w, S: Horizontal splitter window

Ctrl+w, V: Vertical splitter window


Ctrl+w, {↑|↓} toggle edit window


Vim

-O sub-window horizontal display

-O sub-window vertical display


: w [<path>] Save as another file

: R <filename> Insert the contents of a different file under the current cursor


: Set Nonu Cancel line number

: Set NU Displays the number of rows

: Set IC ignores case

: Set Noic de-ignores case

: Set AI Auto Indent

: Set Noai Cancel Auto Indent


: Set hlsearch setting search keyword highlighting

: Set nohlsearch close search keyword highlighting


: syntax {on|off} syntax coloring

**************************************************


[Vimtutor]

Vimtutor a VIM Description program

L-1-13 Linux 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.