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

时间:2019-05-19 11:50:53

标签: vim

我定义了以下命令,将文件选择导出到Lat Lon Alt Temperature Relative Humidity Wind speed Wind direction Short-wave irradiation 2018-01-01 00:00:00 31.03 49.36 99 285.56 52.82 2.95 128.5 0 2018-01-01 01:00:00 NaN NaN NaN NaN NaN NaN NaN NaN 2018-01-01 02:00:00 NaN NaN NaN NaN NaN NaN NaN NaN 2018-01-01 03:00:00 NaN NaN NaN NaN NaN NaN NaN NaN 2018-01-01 04:00:00 NaN NaN NaN NaN NaN NaN NaN NaN 文件中,然后使用html打开文件进行打印

Google Chrome

一个令人讨厌的事情是,每次执行命令时,vim部分都消失了,我必须键入command! -range WebPrint <line1>,<line2>call Print() function! Print() :'<,'>TOhtml :wq :!/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome %:p.html endfunction 才能返回(击中Ctrl-c会再次奇怪地执行命令)。运行命令后是否可以自动返回vim部分?

1 个答案:

答案 0 :(得分:1)

来自model.evaluate

:help call

您的 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

另请参阅<line1>,<line2>