Vim Cheat Sheet
This article will be continuously updated.
Moving around
h
j
k
l
moveleft
up
down
right
ONE character.5 h
move 5 characters towards left.gg
jump to the first line.5 G
jump to the fifth line.
Editing
~
toggle case of ONE character, or N continuous characters with motion. like4u
to changehello
toHELLo
(cursor at h)
FUO (Frequently Used Operations)
How to make HTML soup more tiny in vim ?
- first join all the lines -
ggVGgJ
- Now break tags to new lines -
:%s/>\s*</>\r</g
- Now set filetype -
:set ft=html
(you can do this before too) - Now Indent -
ggVG=
original answer: https://www.quora.com/How-do-you-auto-format-HTML-in-Vim
- first join all the lines -
how to open the directory of the current open file
use
:Sex
or:Vex
command.Sex
refers toSexplore
akaSplit&Explore current file's directory
.V
forVertical
.show file path of the current open file
CTRL-G (Not Shift-G, which is jump to the very bottom of the file)
no comments