4 ms·
In Vim: :w !sudo tee % Which I map to :w!! Of course, if you’re not using Vim, you’re doing it wrong :)
by tambourine_man 3y ago
In Vim:
:w !sudo tee %
Which I map to :w!!
Of course, if you’re not using Vim, you’re doing it wrong :)
- phanimahesh 3y agoIt is a little less useful if the file is not readable by your user, and once you authenticate anything within your vim can also silently run other sudo commands since on most distros sudo remembers the autnentication for a while. Now that I think of it, not sure how sudoedit behaves wrt this cached auth.
- KMnO4 3y agoI think you can use the sudo -k flag to clear the cached auth
- deleted 3y ago[deleted]