Get the App
SLTechnology News&Howtos  ›  Network Security  › 

The use of vim

Shulou Source: shulou.com Published: 2022-06-01 05:38:07 10月04日 Update

Vim goes in edit mode

Press I-to enter the editing mode

Press esc-to exit editing mode

Press u to undo in normal mode

Press I-cursor to enter the edit mode at the beginning of the line

Press a-cursor to enter the edit mode after the character

Press A-cursor to enter the edit mode at the end of the line

Press o-add a line below the cursor to edit the mode

Press O-add a line above the cursor to edit the mode

Vim command mode

W-write

Q-quit

Wq-write to quit

Q! -forced exit

Set nu-display line number

Set nonu--- cancel line number

/-search

N-jump down

Shift+n-Jump up

? -search

N-jump up

Shift+n-Jump Down

Replace

: 1Magic 20sCompact iptablespacing iptablesscarp replace IPTABLES in lines 1-20 with iptables

G global replacement

1the IPTABLES of the document is replaced by the iptables

1. Recording%

:% s/IPTABLES/iptables/g replaces all IPTABLES of the document with iptables

\ get out of mind

: 1 tes/ /\ / etc\ / /\ / 123\ / g replace / tes/ with / 123 /

\ can be replaced by #

Replace / tes/ with / 123 /

: nohl unhighlight

"vim" is a keyboard-operated editor, so there are many function keys in each mode.

Tags: Mode cursor line document plus one line number search global function command character editor keyboard highlight force Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi MariaDB Microsoft Linux Shulou Technology