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如何从用户定义的命令自动返回_Vim - Fatal编程技术网

Vim如何从用户定义的命令自动返回

Vim如何从用户定义的命令自动返回,vim,Vim,我定义了以下命令,将文件选择导出到html文件中,然后使用googlechrome打开它进行打印 command! -range WebPrint <line1>,<line2>call Print() function! Print() :'<,'>TOhtml :wq :!/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %:p.html endfuncti

我定义了以下命令,将文件选择导出到
html
文件中,然后使用
googlechrome
打开它进行打印

command! -range WebPrint <line1>,<line2>call Print()
function! Print()
    :'<,'>TOhtml
    :wq
    :!/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %:p.html
endfunction
命令-范围网络打印,调用打印()
功能!打印()

:“来自
:帮助呼叫

    When a range is given and the function doesn't handle it
    itself, the function is executed for each line in the range,
您的
Print
函数是在没有
range
的情况下定义的,因此它会被多次调用,对于所选范围内的每一行调用一次

如果这不是您想要的,请删除


另请参见
:帮助功能范围示例

我明白了,谢谢!现在,每次调用函数后,vim会话都会被转移到bash会话,并说
按ENTER键或键入command继续
。有没有办法自动返回vim会话?请使用
silent/应用程序/…
。可能还需要重新绘制
。请参见
:help下的最后两段!cmd