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:

posted @ 2013-03-07 19:22  ibg  阅读(554)  评论(0编辑  收藏  举报