你们中的许多人可能已经看到了允许您在需要root权限的文件上写入的命令,即使您忘记使用sudo打开vim:
:w !sudo tee %问题是我不明白这里到底发生了什么。
我已经想到了:w就是这个
                                                        *:w_c* *:write_c*:[range]w[rite] [++opt] !{cmd}Execute {cmd} with [range] lines as standard input(note the space in front of the '!').  {cmd} isexecuted like with ":!{cmd}", any '!' is replaced withthe previous command |:!|.所以它将所有行作为标准输入传递。
!sudo tee部分以管理员权限调用tee。
为了让所有人都有意义,%应该输出文件名(作为tee的参数),但我找不到对此行为的帮助的引用。
tl; dr有人能帮我剖析这个命令吗?
 
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                             
                                
                            