Vim scenarios
Vim basics
Movement:
| Command | shortcut |
|---|---|
| Move row down | Ctrl Y |
| Move row up | Ctrl E |
| Move half page down | Ctrl D |
| Move half page up | Ctrl U |
| Move page up | Ctrl B |
| Move page down | Ctrl F |
| Move current line top | zt |
| Move current line middle | zz |
| Move current line bottom | zb |
Window management:
| Command | shortcut |
|---|---|
| Vertical split | :vspl |
| Split vertical | Ctrl w v |
| Split horizontal | Ctrl w s |
| Navigation | Ctrl w |
| Close | Ctrl w c |
| increase width | ctrl w > |
| decrease width | ctrl w < |
| increase height | ctrl w + |
| decrease height | ctrl w - |
| reset equals | ctrl w = |
| maximize split | ctrl w _ |
| split | :sp |
| vertical split | :vsp |
Copy paste:
| Command | shortcut |
|---|---|
| copy is yank | y |
| cut is delete | d |
| yank line | yy |
| delete line | dd |
| yank word | yw |
| delete word | dw |
| paste after cursor | p |
| paste before cursor | P |
| copy one char | y |
| one tip like cut undo |
you can prepend register in front of
- “
register - ”” default register
- ”+ and “* system registers(on windows same)
- % Name of the current file
- : Most recently executed command
- . Contains the last inserted text
- “ Last used register
Bookmarks:
| Command | shortcut | remark |
|---|---|---|
| New bookmark | m |
big letter means global bookmark |
| Go to bookmark | ` |
exact location |
| Go to bookmark line | ‘ |
exact location |
| Show bookmarks | :marks | |
| Delete bookmaraks | :delmarks |
see bookmarks
Buffers:
| Command | shortcut |
|---|---|
| Next buffer | :bnext or :bn |
| Previous buffer | :bprev or :bp |
| Switch by number | :b nr |
| Switch by name | :b part of name |
| Buffers’ list | :buffers |
| Jump backward | Ctrl-o |
| Jump forward | Ctrl-i |
| Switch prev buffer and back | Ctrl-^ |