My VIM cheatsheet

My VIM cheatsheet


Auto brake long lines

gq{motion} % format the line that {motion} moves over
{Visual}gq % format the visually selected area
gqq        % format the current liner        

Split windows

Vertical split

:vs
:vsp {file path}        

Horizontal split

:s
:sp {file path}        

Swap windows

Swap with the left window
cntr+w H
Swap with the right window
cntr+w L 
Swap with the window below
cntr+w J
Swap with the windows above
cntr+w K        

Open Terminal in the current window

:term        

Bonus: vimdiff

]c :??????? - next differenc
[c :??????? - previous difference
do????????? - diff obtain
dp????????? - diff put
zo????????? - open folded text
zc????????? - close folded text
:diffupdate - re-scan the files for differencese        

要查看或添加评论,请登录

社区洞察

其他会员也浏览了