While editing code, I frequently cycle between changing the code and running some commands: running unit tests, linting tools, style checker, restarting services, etc.
I generaly do that directly from inside vim with
:!command and then repeating it with
While this is good, I learned a trick a while ago that still ranks as one of my favorites.
Add this to your
Then run your command as
:wa|!command and repeat it with just
\] directly on normal mode.
] are not next to each other on your keyboard layout, just change the mapping
to something that is very easy and convenient to type :)
This is quicker to type, it saves all the files before running the command and it still allows you
to run that one-off
:!command in between your cycle without it getting in the way of your repetition.
That’s it. Happy Vimming!