我正在使用 vim 和 python 模式扩展,但我很难使用包含 r
的命令。它导致 vim 替换字符而不是执行我想要的命令。
这是 python 模式的 vim 文档所说的 -
let g:pymode_rope_organize_imports_bind = '<C-c>ro'
所以我正在执行CTRL-cro,但就像我说的,它正在替换我所在的任何字符字母o
。
我错过了什么?
请您参考如下方法:
Vim 似乎没有解释您的映射,因此它只看到 Ctrl-c,默认情况下会中止当前操作,然后是替换命令 r
(参见 :help r
)后面跟着它的“参数”。
您可以检查映射是否是用 :map <c-c>
定义的.
如果定义正确,则可能是您的终端直接处理 Ctrl-c 而不是将其传递给 Vim,如 Vim FAQ 20.5 - Why does mapping the key not work? 中所述。 。在这种情况下,您可以按照Vim FAQ 20.4 - I am not able to create a mapping for the key. What is wrong?上的说明进行操作。 ,特别是:
1) First make sure, the key is passed correctly to Vim. To determine if
this is the case, put Vim in Insert mode and then hit Ctrl-V (or
Ctrl-Q if your Ctrl-V is remapped to the paste operation (e.g. on
Windows if you are using the mswin.vim script file) followed by your
key.
If nothing appears in the buffer (and assuming that you have
'showcmd' on, ^V remains displayed near the bottom right of the Vim
screen), then Vim doesn't get your key correctly and there is nothing
to be done, other than selecting a different key for your mapping or
using GVim, which should recognise the key correctly.