How to use VIM parameters

Source: Internet
Author: User

Vim General mode:

(1) Press the X key to delete the contents of the bank (backward delete)

(2) press SHIFT + X to delete the previous contents of the bank (delete forward)

(3) Press the number n and then press the X key to remove the N characters backwards

(4) Press the number n and then press SHIFT + X to remove n characters forward

(5) You can press the U key if you want to rewind the edit operation. Up to 50 times can be rolled back

(6) If you want to undo the fallback operation, you can press CTRL + R

(7) If you want to delete a row, press the D key two times, at which point the deleted content is stored in the clipboard of memory. If you press the P key at this point, you can paste the content you just deleted on the next line in the current row. If you press the SHIFT + P key, you can paste the previous line in the current row.

(8) If you press the number n and then the DD, you can delete the n rows.

(9) If you press the number n and then the YY, you can copy n rows.

(10) Press the number n, then press X, then delete (also cut) at this time. Of course, you can press p to paste at this point.

(11) Press the V key first, enter the visual mode, at this time press (H,J,K,L) key to move the cursor, select the selected text (or text block), and then press the X key, at this time the selected text (or text block) will be saved to the clipboard of memory


Vim edit mode


(1) Press the I key, the cursor at the current position, and enter the editing mode

(2) Press the I key, at which point the cursor moves to the beginning of the current line and enters edit mode

(3) Press the A key, the cursor moves back one position and enters edit mode

(4) Press the A key, at which point the cursor moves to the end of the current line and enters edit mode

(5) Press the O key, at which point the cursor moves to the beginning of the next newly inserted line of the current line and enters edit mode

(6) Press the O key, at which point the cursor moves to the beginning of the newly inserted line on the current line and enters edit mode



VIM command line mode


: Wq Write and exit: W write: Q exit three can match! Using the force execution

: Set NU Displays line number: Set Nonu does not display line numbers

/iptables search string iptables, will highlight the characters being searched, N jumps down, shift+n jumps up

Iptables search string iptables, will highlight the characters searched, shift+n down, n jumps up

: 1,20s/iptables/iptables/g replaces 1-20 rows of IPTABLES with Iptables,g as the global substitution, otherwise only the previous one is replaced when there are two IPTABLES on a row.

: 1, $s/iptables/iptables/g will 1-$ refers to 1-the last line, the entire document

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

For the character to be replaced with/the processing method is preceded by a \ used to decipher, so that the machine computer recognition

or such as the expression in/with other words # or @


How to use VIM parameters

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.