Vim formatting goodness

Posted on Wed 20 June 2012 in misc • Tagged with vim

So I wanted to paste this licence into my piece of code http://www.opensource.org/licenses/bsd-license.php

But I wanted it be wrapped to no more than  79 characters a line and before each sentence I wanted to insert a "# "

This is how

:set paste (paste text from …

Continue reading

Writing files as root in vim

Posted on Wed 10 August 2011 in misc • Tagged with vim

I do this at least once a day; open a file in vim, make changes, then get reminded that I didn't do it using sudo.

simple one-liner fixes this.

:w !sudo tee %

Thanks to http://www.cyberciti.biz/faq/vim-vi-text-editor-save-file-without-root-permission/ for that one.


Continue reading