Last Updated: February 25, 2016
·
868
· rshetty

'sudo' after opening the file

You open the file and find that you need the superuser privileges for writing the file. You can easily give superuser privileges after opening a file using the famous trick

:w !sudo tee % > /dev/null

Instead a better way is to declare this in your .vimrc file

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

Basically the next time you just have to use 'w!!' to give the superuser privileges for the app and write it.

Happy Hacking....

1 Response
Add your response

Awesome tip, thanks for that. I'd remove the "rails" tag tho, since this tip is useful to any file type.

over 1 year ago ·