Linux Text editor vim

Source: Internet
Author: User
Tags linux text editor

Vim

Vim is a powerful full-screen text editor, which is the most commonly used text editor on Linux/unix , and its function is to create, edit and display text files.

Note:vim does not have a menu, only commands

VI [filename ] Enter command mode

WQ Exit Command mode

Input i a O from the command mode into insert mode

Press ESC to exit Insert mode and enter Command mode

Input: Enter edit mode by command mode

Enter command to end run with enter command mode


Insert command


Command Role
A

Insert after the character of the cursor

A

Insert at the end of the line where the cursor is

I

Insert in the word match either the cursor

I

Insert at the beginning of the line where the cursor is

O

Insert a new line under the cursor

O

Insert a new line on the cursor

Position command

Command Role
: Set Nu

Set line number

: Set Nonu

Cancel line number

Gg

To the first line

G

To the last line

NG

to nth row

: N

to nth row

$

Move to end of line

0

Move to the beginning of the line

Delete command

Command Role
X

Delete the character at the cursor location

Nx

Delete the first n characters at the cursor location

Dd

Delete Row of cursor,ndd Delete n rows

Dg

Delete the line from the cursor to the end of the file

D

Delete the cursor at the end of the line

: n1,n2d

Delete a specified range of rows

Copy and Cut commands

Command Role
Yy

Copy when moving forward

Nyy

Copy the following n rows of the current row

Dd

Cut when moving forward

Ndd

Cuts the current n rows

P, p

Paste at the current cursor row or line

Replace and Cancel commands

Command Role
R

Cancels the character at which the cursor is located

R

To replace a character from where the cursor is, press ESC to end

U

Cancel the previous action

Search and search Replacement commands

command
/string

search for the specified string, Ignore case when searching :set ic

n

:%s/old/new/g

:n1,n2s/old/new/g

Save and Exit commands

Command Role
: W

Save changes

: w new filename

Save as specified file

: Wq

Save changes and exit

Zz

Shortcut keys, save changes and exit

: q!

Do not save changes to exit

: wq!

Forcibly save the changes and exit (the file owner and root can be used)


This article is from the "djh01" blog, make sure to keep this source http://djh01.blog.51cto.com/10177066/1690340

Linux Text editor vim

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.