保存时获取sudo权限

:w !sudo tee "%" > /dev/null
W12: Warning: File "sudofile" has changed and the buffer was changed in Vim as well
See ":help W12" for more info.
[O]K, (L)oad File: 

输入 L

:q 退出

See Also

https://vim.fandom.com/wiki/Su-write