VIM Emacs 临时获得权限(:w !sudo tee %)

VIM

有时用 VIM 编辑文件时常忘了加上 sudo,在保存时就会提示没有权限。

用命令 :w !sudo tee %

Emacs

C-x C-w后提示

Write file: /mnt/study/python.py

这时加上 /sudo::

Write file: /sudo::/mnt/study/python.py

就会有提示输入密码了
Password for /sudo:root@VirtualBox:

原文地址:https://www.cnblogs.com/ibgo/p/2948652.html