Hulk
Hulk

Reputation: 34170

Switching to superuser mode in vim session

After opening a file created by root in vim, how to change the current user to superuser mode without quitting or before saving?

Upvotes: 15

Views: 5967

Answers (1)

Ressu
Ressu

Reputation: 693

This should do the trick.

:w !sudo tee %

More tricks like that here: http://vim.wikia.com/wiki/Su-write

Upvotes: 36

Related Questions