Linux VI Editor

Source: Internet
Author: User

Vim processes data in a memory buffer

If you do not specify a file name when you start Vim, or if the file does not exist, VIM will open a new buffer to edit.

H move one character to the left

J Move down one line

K Move up one line

L Move one character to the right

PageDown (ctrl+f) turn over a screen of data

PageUp (ctrl+b) Flip a screen

G moves to the last row of the buffer

Num G moves to the first NUM line in the buffer

GG moves to the first row of the buffer

Q! Cancels all modifications to the buffer data and exits

W filename Saves the file to another file name

X Delete the character at the current cursor position

DD deletes the cursor in the row

DW Delete Word with cursor

d$ Delete content from cursor to end of line

J stitching rows (current and next lines, removing line breaks at the end of the current line)

U undo Previous Edit Command

A append data after the current cursor

A append data at the end of the current line

R Char replaces a single character at the current cursor position with Char

R text overwrites the data at the current cursor position with text until the ESC key is pressed

Some commands allow numbers to be used to specify how many times the command repeats: 5J,10DD, etc.

Cut, copy

When vim deletes data, it actually saves the data in a separate register. You can use the P command to retrieve the data. (This attribute can be deleted for clipping)

Copy operation with the y command (yw copy the word, y$ copy to the end of the line, you can also copy multiple lines in the visual mode, press the V key into the visual mode, select the content to copy, press the Y key), after the copy succeeds, move the cursor to where you want to paste, press the P key

Find, replace

/texttofind

Pressing the N key indicates the next

: s/old/new/replaces the first occurrence of old

: S/old/new/g replaces all of our old

:%s/old/new/g replaces all old in the file

:%S/OLD/NEW/GC replaces all old in the file, but prompts each time it appears

: N,ms/old/new/g replaces all old between line number N and M

Linux VI Editor

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.