gpt4 book ai didi

windows - VIM "!"和 Windows 启动命令

转载 作者:可可西里 更新时间:2023-11-01 11:45:58 24 4
gpt4 key购买 nike

我已经配置了<F5>使用 Windows 启动命令,但尝试使用命令行选项 "/wait"会使 VIM 混淆,从而不再找到该命令。

这是我的旧映射:

noremap <F5> :w<CR>:!start "%:p"<CR>

我将映射更改为:

nnoremap <F5> :w<CR>:!start /wait "%:p"<CR>

使用后者会导致如下错误:

E371: command not found

但是为什么“command not found”,命令还是“start”,不是吗?

提前致谢!

最佳答案

Vim 自己实现 :!start 命令,因为 Vim 必须正确处理后台命令。而且它没有 /wait 选项。请参阅 :help :!start

Using "start" stops Vim switching to another screen, opening a new console, or waiting for the program to complete; it indicates that you are running a program that does not affect the files you are editing. Programs begun with :!start do not get passed Vim's open file handles, which means they do not have to be closed before Vim.

To avoid this special treatment, use ":! start".

:nnoremap <F5>  :w<CR>:! start /wait %:p<CR>

仅供引用:原始启动命令不需要双引号作为参数。

关于windows - VIM "!"和 Windows 启动命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44865455/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com