该错误为当前用户没有权限对文件作修改
输入
:w !sudo tee %
- :w – write
- !sudo – call shell sudo command
- tee – the output of write (:w) command is redirected using tee
- % – current file name
本文介绍了一种在遇到没有足够权限修改文件时的解决方案。通过使用特殊的 Vim 命令结合 sudo 来绕过权限限制并完成文件的保存操作。
该错误为当前用户没有权限对文件作修改
输入
:w !sudo tee %

被折叠的 条评论
为什么被折叠?