Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vim 当使用--remote tab silent选项运行时,如何从标准输入创建读取缓冲区?_Vim_Pipeline - Fatal编程技术网

Vim 当使用--remote tab silent选项运行时,如何从标准输入创建读取缓冲区?

Vim 当使用--remote tab silent选项运行时,如何从标准输入创建读取缓冲区?,vim,pipeline,Vim,Pipeline,以下命令成功启动从标准输入读取编辑缓冲区的vim echo hi | vim - 但是这个不行 echo hi | vim --remote-tab-silent - 当运行上述命令时,出现以下警告,vim退出 Vim: Warning: Input is not from a terminal Vim: Error reading input, exiting... Vim: preserving files... Vim: Finished. 为什么在第二种情况下它不从标准输入读取 v

以下命令成功启动从标准输入读取编辑缓冲区的vim

echo hi | vim -
但是这个不行

echo hi | vim --remote-tab-silent -
当运行上述命令时,出现以下警告,vim退出

Vim: Warning: Input is not from a terminal
Vim: Error reading input, exiting...
Vim: preserving files...
Vim: Finished.
为什么在第二种情况下它不从标准输入读取

vim的帮助消息似乎表明它应该工作

$ vim -h | head
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Mar 31 2015 23:36:07)

usage: vim [arguments] [file ..]       edit specified file(s)
   or: vim [arguments] -               read text from stdin
   or: vim [arguments] -t tag          edit file where tag is defined
   or: vim [arguments] -q [errorfile]  edit file with first error

Arguments:
   --           Only file names after this
   -g           Run using GUI (like "gvim")
$ vim -h | grep remote
   --remote <files> Edit <files> in a Vim server if possible
   --remote-silent <files>  Same, don't complain if there is no server
   --remote-wait <files>  As --remote but wait for files to have been edited
   --remote-wait-silent <files>  Same, don't complain if there is no server
   --remote-tab[-wait][-silent] <files>  As --remote but use tab page per file
   --remote-send <keys> Send <keys> to a Vim server and exit
   --remote-expr <expr> Evaluate <expr> in a Vim server and print result
$vim-h |头
VIM-Vi改进了7.4(2013年8月10日,2015年3月31日汇编23:36:07)
用法:vim[参数][文件..]编辑指定的文件
或:vim[参数]-从标准输入读取文本
或:vim[arguments]-定义标记的t标记编辑文件
或:vim[arguments]-q[errorfile]编辑带有第一个错误的文件
论据:
--仅在此之后显示文件名
-g使用GUI运行(如“gvim”)
$vim-h | grep遥控器
--如果可能,在Vim服务器中进行远程编辑
--远程静默相同,如果没有服务器,不要抱怨
--远程等待为--远程但等待文件被编辑
--远程静默等待,如果没有服务器,请不要抱怨
--远程选项卡[-wait][-silent]作为--远程,但使用每个文件的选项卡页
--远程发送到Vim服务器并退出
--远程expr在Vim服务器中求值并打印结果
当使用
--remote
时,您不能从标准输入进行编辑

:h --remote

--远程[+{cmd}]{file}。。。
在远程Vim中打开文件列表。什么时候
没有Vim服务器,请在本地执行。
有一个可选的init命令:+{cmd}。
这必须是一个可以执行的Ex命令
然后是“|”。
命令行的其余部分作为
文件列表。因此,任何非文件参数都必须
在这之前来。
您不能以这种方式编辑stdin |--|。
远程Vim升起。如果你不想
此用途>
vim--远程发送“:n文件名”

--远程静默[+{cmd}]{file}…
如上所述,但如果没有,不要抱怨 服务器,并在本地编辑该文件

--远程选项卡无提示—远程无提示,但在 新标签页。

请告诉(如果可能和需要)您要编辑的管道,因为可能还有其他解决方案。我正在尝试编辑现有Vim实例中现有shell命令的任何输出,即,我不想启动新的Vim实例。我想将shell命令的输出通过管道传输到现有的Vim实例中,这样输出就会出现在新的选项卡中。好的,如果您已经有一个实例在运行,也许您可以打开一个新的缓冲区或选项卡(
:enew
:tabnew
),然后使用类似
:r!shell_命令-args
将其直接读取到缓冲区。

 --remote [+{cmd}] {file} ...
                          Open the file list in a remote Vim.  When
                          there is no Vim server, execute locally.
                          There is one optional init command: +{cmd}.
                          This must be an Ex command that can be
                          followed by "|".
                          The rest of the command line is taken as the
                          file list.  Thus any non-file arguments must
                          come before this.
                          You cannot edit stdin this way |--|.
                          The remote Vim is raised.  If you don't want
                          this use >
                           vim --remote-send "<C-\><C-N>:n filename<CR>"

--remote-silent [+{cmd}] {file} ...
As above, but don't complain if there is no server and the file is edited locally.

--remote-tab-silent Like --remote-silent but open each file in a new tabpage.