Linux Learning Summary (13) Text editor vim

Source: Internet
Author: User
Vim is an upgraded version of VI, which is displayed according to the text attributes, with the following details:

General mode:

1. Cursor Positioning:
Move left and right one character, H L
Move one character up or down, K J
Left and right down, around on both sides, down in the middle so remember
Cursor positioned at the beginning of shift+6 ^
Cursor positioning line End shift+4 that is $
Cursor positioned to the first line of text GG
Cursor is positioned to the end of the text line G
The light table is positioned to the nth row NG N is a number
Page Up Ctrl B or PgUp
Page back Ctrl F or PGDN
2. Delete Copy sticky
X Remove one character backwards
X Delete one character forward
DD Delete current in full row
NDD down Delete n rows
YY Copy a row
NYY copy n rows down
P Paste on the next line of the cursor
P paste on the previous line of the cursor
3. Find and replace
/word Press N to search backwards for character word
? Word presses N to search for characters ahead of Word
: n1,n2s/word1/word2/g find word1 between N1 rows and N2 rows and replace with Word2
The slash can be replaced with a # number
: 1, $s/word1/word2/g find to tail line substitution

Two-edit mode

I insert characters in the current character match either
A inserts a character specifier the current character
I insert characters at the beginning of a line
o Insert a new line down
O insert a new line up

Three-command mode

: Wq Save Launch
: q! Mandatory rollout
: wq! Force Save exit
: Set NU Displays line number
: Set Nonu suppress line numbers
U undo the previous action,
CTRL R Redo Undo

Linux Learning Summary (13) 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.