vim tricks (from stackoverflow)

There are a couple of tricks in vim that I keep needing to look up in my Stack Overflow favourites.  The first is to save a file that needs root access when you haven’t loaded vim as root.

:w !sudo tee %

http://stackoverflow.com/questions/726894/what-are-the-dark-corners-of-vim-your-mom-never-told-you-about/726920#726920

The second is using vim as a hex editor,

:%!xxd -g 1

and to reverse it,

:%!xxd -r

http://stackoverflow.com/questions/726894/what-are-the-dark-corners-of-vim-your-mom-never-told-you-about/727634#727634

Advertisements

One thought on “vim tricks (from stackoverflow)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s