This post extracts some knowledge from Chapter 1 -- The Vim Way.
[!TIP] Meet the Dot Command
The dot command lets us repeat the last change.
The >G command increases the indentation from the current line until the end of the file.
[!TIP] Don't Repeat Yourself
| Compound Command | Equivalent in Longhand |
|---|---|
C |
c$ |
s |
cl |
S |
^C |
I |
^i |
[!TIP] Take One Step Back, Then Three Forward
[!TIP] Act, Repeat, Reverse
| Intent | Act | Repeat | Reverse |
|---|---|---|---|
| Make a change | {edit} | . |
u |
| Scan line for next character | f{char} / t{char} |
; |
, |
| Scan line for previous character | F{char} / T{char} |
; |
, |
| Scan document for next match | /pattern<CR> |
n |
N |
| Scan document for previous match | ?pattern<CR> |
n |
N |
| Perform substitution | :s/target/replacement |
& |
u |
| Execute a sequence of changes | qx{changes}q |
@x |
u |
[!TIP] Find and Replace by Hand
* executes a search for the word under the cursor.
[!TIP] Meet the Dot Formula
The Ideal: One Keystroke to Move, One Keystroke to Execute
原文链接:https://zhuang.dev/reading/practical-vim/01-the-vim-way/
