Wednesday, 5 August 2009

vim tricks

Some tools are loaded with plenty of features and it's all too easy to get familiar with just a small subset of these features and forget or not explore the full functionality of the tool.

Take vim for example - it's an extended vi clone that comes with lots of vi extensions and improvements. I learnt to use vi back in the late 1980's and got settled into using enough functionality to be productive. Then I switched to using vim and never really put in all the effort to explore all the extra features it supports. Then this morning I stumbled upon this vim trick:

cmap w!! %!sudo tee > /dev/null %

which basically allows one to write over a file as sudo. Yes it's evil, but it it's also very helpful!

There are a whole bunch of other vim tricks listed at stackoverflow.com - I recommend checking it out as it contains some useful vim nuggets of goodness. I also recommend visiting viemu.com's vi/vim cheat sheet page - it has some excellent vi/vim keymap images.

No comments:

Post a Comment