Reputation: 908
Sometimes i feel annoyed closing it from read only and opening it again in write mode to edit. If haven't opened a file with sudo permission and if incase i just want to switch that by some command within a vim. Is it possible?
Upvotes: 0
Views: 107
Reputation: 20456
You can use the following command to save a file you edited in vim without the needed permissions:
:w !sudo tee %
Upvotes: 1