vim将K映射到外部命令

时间:2015-08-01 23:44:25

标签: vim

我想将vim的try映射到Dash,即使用'keywordprg'K

目前,我正在这样做:

!open dash://word-unser-curse

但它说:let &keywordprg '!open dash://'

1 个答案:

答案 0 :(得分:0)

来自:h E34

        Any '!' in {cmd} is replaced with the previous
        external command (see also 'cpoptions').  But not when
        there is a backslash before the '!', then that
        backslash is removed.  Example: ":!ls" followed by
        ":!echo ! \! \\!" executes "echo ls ! \!".

因此,您必须转义!才能让vim按原样处理,否则vim会尝试将其替换为“previous command”,从而导致错误。

此外,我认为您!中不需要keywordprg。无论如何,Vim将其称为外部命令(默认值为man,而不是!man)。