Day8-1 vim

Source: Internet
Author: User

Vim Editor
is an upgraded version of VI with color display
Install Yum install-y vim-enhanced


Copy the passwd file to a different directory with no color after vim

General mode
Left and RIGHT ARROW keys or KJHL four keys to move the cursor
N-directional key moves n-bits in a specific direction
CTRL + B or PageUp page up
CTRL + F or PageDown page Down
0 or Shift 6 cursor moves to the beginning of the line
Shift 4 cursor moves to end of line
GG moves to the first line
G move to the last line
NG moves to nth row
X Remove one character backwards
X Delete one character forward
NX removes n characters backwards
DD Delete/Cut the line where the cursor is located
NDD Delete/cut n rows after the row of the cursor (including rows of n rows)
YY the copy cursor is in the row
Nyy to copy n rows (including rows) from the line where the cursor is located
P Paste Down
P Paste Up
U undo up-Step operation
CTRL + R Redo Undo operation
V Press and hold move to select the character. Similar to the shift under word

Edit mode
I enter edit mode, the cursor does not move
I (uppercase i) enters edit mode and the cursor moves to the beginning of the line
o the cursor inserts a row below
O the cursor inserts a row above
A cursor in the latter one
A cursor at the end of row

Command mode
/[word] to find the string after the cursor, press N to continue to find
? [Word] finds a string before the cursor, press N to continue searching
: n1,n2s/[word1]/[word2]/g find word1 between N1 and N2 rows and replace with Word2, no G replaces only the first word1 of each row (in # instead of/)
: 1, $s/[word1]/[word2]/g find word1 in the document and replace with Word2, no G replaces only the first word1 of each row
: W Save Text
: Q exit
: w! Force Save
: q! Force exit
: Wq Save and exit
: Set NU Displays line number
: Set Nonu does not display line numbers

Day8-1 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.