Vim basic commands

Source: Internet
Author: User
I read some documents and summarized some basic Vim commands suitable for programmers. they are not very complete, but at least practical... All are the most basic vim tutorials. open the terminal under fedora. Input vimfilename to enter the vim // basic file. ..

 

I read some documents and summarized some basic Vim commands suitable for programmers. they are not very complete, but at least practical... Are the most basic

Vim tutorial

Open the terminal under fedora.

Input vim filename to enter vim

///////////////////////////////

Basic file operations

W: Save

Wq: Save and exit

Q! : Do not save and exit

///////////////////////////////

Delete Command

In command mode, enter

Dw press enter to delete the cursor position character

D is to delete all characters in the row (this is useful for writing programs)

Dd deletes a row.

U undo operation www.2cto.com

//////////////////////////////

Search command

/String here is the string you want to search.

N jumps to the next target of the current search target.

+ N search back.

//////////////////////////////

Bracket matching command

Place the cursor under the brackets and enter

% Will automatically jump the cursor to the matching brackets, which is useful for writing programs.

//////////////////////////////

Copy and select

GgyG: all copies

DG: delete the content after the cursor (move the cursor to the beginning to delete all content)

P: Mark the content of the paste cache area.

Yy: copy the current row

Nyy: copy the content of n rows down where the cursor is located.

//////////////////////////////

Cursor movement command

0: move to the front of the row where the cursor is located

$: Move to the end of the row where the cursor is located

H: move the first column of the first row of the current screen

M: move the first column of the middle row of the current screen

L: move the first column of the last row of the current screen

NG: Move to row n

N-: Move n rows up

N +: Move n rows down

G: move to the beginning of the last row

 

From firefoxbug's column

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.