[英]vim - execute - shell command?
I want to add a mapping which will visualize the output of a shell command in a new window. 我想添加一个映射,该映射将在新窗口中可视化shell命令的输出。 the problem is the command is interrupted when moving the cursor to the top of the file.
问题是将光标移到文件顶部时命令被中断。
:execute ":new \| set nonu \| 0r ! ls \| normal! gg"
I figured out that the problem is with the execute command which considers the part from the symbol !
我发现问题出在执行命令中,它考虑了符号中的部分
!
to the rest of it as a shell command ( ls | normal! gg
) and that's why it shows an error when being executed. 其余的内容作为shell命令 (
ls | normal! gg
),这就是为什么它在执行时显示错误的原因。
How to prevent that ? 如何预防呢?
When a command doesn't accept <bar>
to separate the command. 当命令不接受
<bar>
分隔命令时。 The normal way to fix this is wrap the command in a execute which does except bars 解决此问题的正常方法是将命令包装在可执行文件中,除了酒吧
:execute ":new \| set nonu \| execute '0r ! ls' \| normal! gg"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.