This week I learned 09
After putting it off for too long, I finally started digging into the vim(1)
manuals. Naturally, I’ve already learned a ton. Including a few new tricks that
will antiquate old (, bad) habits.
:g[lobal]/{pattern}/[cmd]
: performcmd
on lines that matchpattern
. This is handy for sorting#include
statements::g/^#include/sort
{visual}J
: thevim(1)
analogue to python’sjoin()
method. I used to do this by visually selecting some text, then running:'<,'>s/\n//g
. HittingJ
is much faster.