Vim's editing mode, Command mode, and vim practice operation

Source: Internet
Author: User

I. VIM's editing mode

Second, vim command mode

Third, VIM practice operation
# Cp/etc/dnsmasq.conf/tmp/1.txt

(1) Move Down, right, left, and up 6 characters (6j 6l 6h 6k) respectively.
(2) turn down and up two pages (two times ctrl+f and Ctrl+b respectively). The
(3) Moves the cursor to line 49th (49G).
(4) Move the cursor to the end of the line, and then move to the beginning (Shift+4, shift+6).
(5) moves to the last line of the 1.txt file (G).
(6) moves to the first line of the file (GG).
(7) Search for "DNSMASQ" in the file and count the number of occurrences of the string (/DNSMSQ and then press N). The
(8) replaces the DNSMASQ from line 1th to line 10th with DNS (: 1,10s/dnsmasq/dns/g).
(9) Restore the previous action (U). The
(10) replaces all the etc in the entire file with a CTE (: 1, $s/etc/cte/g).
(11) Move the cursor to line 25th, delete the string "ly" (25G then press L to move the cursor to the right to find "ly", press V to select, and press X).
(12) Restore the previous action (U).
(13) Delete line 50th (50G dd).
(14) Restore the previous action (U).
(15) Delete all the contents of the 第37-42 line (37G 6DD).
(16) Restore the previous action (U).
(17) Copy the contents of line 48th and paste it below line 52nd (48G yy 52G p).
(18) Restore the previous action (U).
(19) Copy the contents of the 第37-42 line and paste it onto line 44th (37G 6yy 44G P).
(20) Restore the previous action (press U).
(21) Move the contents of the 第37-42 line below line 19th (37G 6DD 19G p).
(22) Restore the previous action (press U).
(23) Move the cursor to the first line, the 1th line to the "#!/bin/bash" (First press GG, the cursor to the 1th line, and then press the letter A, enter the editing mode, > cursor to the end of the line, to modify the operation, after completion, press ESC).
(24) Insert a new line below line 1th and enter "# hello!" (Press O to enter edit mode, while the cursor goes down another line, enter "# hello!" )。
(25) Save the document and exit (press the ESC key and enter ": Wq").

Note:
1,: Set NU display line number: Set Nonu does not display line number

2,/iptables search string iptables, will highlight the characters searched, n Jump, shift+n up jump

3, Iptables search string iptables, will highlight the characters searched, shift+n down, n jump

4,: 1,20s/iptables/iptables/g 1-20 rows of IPTABLES replaced with iptables,g is the meaning of global substitution, otherwise, when a row has two IPTABLES will only replace the previous one.

5,: 1,s/iptables/iptables/g will 1? means 1-the last line, the entire document

6.:%s/iptables/iptables/g entire document,% = 1,$

7, for the word to be replaced with/the processing method is: in front add a \ Used to decipher, so that the machine to identify or display the expression/with other words such as # or @

8.: Nohl Cancel highlighting in document

Vim's editing mode, Command mode, and vim practice operation

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.