将 shell 命令编辑的缓冲区输出到 Vim 中的新缓冲区中?E499: '%' 或 '#' 为空文件名,仅适用于“:p:h”

hhh*_*hhh 4 vim

此线程此处讨论有关将 shell 命令的输出传输到 vim 中的新缓冲区的内容,但它没有通过使用当前缓冲区来讨论它,例如

 %new | r !%gcut -d '"' -f2,4,6,8,10
Run Code Online (Sandbox Code Playgroud)

其中百分号%尝试使用当前缓冲区,不幸的是导致

E499: Empty file name for '%' or '#', only works with ":p:h"
Run Code Online (Sandbox Code Playgroud)

所以

如何将 shell 命令编辑的缓冲区传输到 Vim 中的新缓冲区中?

rom*_*inl 5

:new | r !gcut -d '"' -f2,4,6,8,10 #
Run Code Online (Sandbox Code Playgroud)

#是“上一个文件”的占位符。

如果文件名中有空格,请使用引号

:new | r !gcut -d '"' -f2,4,6,8,10 "#"
Run Code Online (Sandbox Code Playgroud)