Vi escelate用户权限

这个问题在这里已经有了答案:

  • 我可以在不离开vim的情况下获得root权限吗? 2个答案
  • vim“用sudo编写”技巧如何工作? 7个答案

  • 如果你安装了Sudo Edit插件,你会得到命令:SudoWrite ,它会询问你的root密码。 然后它将以root身份写入文件,非常方便。 我经常用它来编辑/ etc /中的东西。

    从文档:

    2.2 SudoWrite                            *SudoWrite*
    
    :[range]SudoWrite[!] [file]
    
    SudoWrite will write the given file using any of the configured methods for
    superuser authtication. It basically does something like this: >
    
         :w !sudo tee >/dev/null file
    
    If no filename is given, SudoWrite will try to write the current file name.
    If the current buffer does not contain any file, it will abort.
    
    You can specify a range to write just like |:w|. If no range is given, it will
    write the whole file. If the bang argument is not given, the buffer will only
    be written, if it was modified.
    
    Again, you can use the protocol handler sudo: for writing.
    
    链接地址: http://www.djcxy.com/p/49569.html

    上一篇: Vi escelate user permission

    下一篇: Command Explanation