2

我正在使用 vim 和 python-mode 扩展,但我很难使用包含r. 它导致 vim 替换字符而不是执行我想要的命令。

这是 python-mode 的 vim 文档所说的 -

let g:pymode_rope_organize_imports_bind = '<C-c>ro'

所以我正在这样做CTRL-cro,但就像我说的那样,它用字母替换了我所在的任何字符o

我错过了什么?

4

1 回答 1

2

看起来您的映射没有被 Vim 解释,所以它只看到 Ctrl-c,默认情况下会中止当前操作,然后是替换命令r(参见 参考资料:help r),然后是它的“参数”。

您可以检查映射是否使用:map <c-c>.

如果定义正确,则可能是您的终端Ctrl-c直接处理而不是将其传递给 Vim,如Vim 常见问题解答 20.5 - 为什么映射密钥不起作用?. 在这种情况下,您可以按照Vim FAQ 20.4 上的说明进行操作 - 我无法为密钥创建映射。怎么了?,特别是:

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.
于 2014-11-12T16:21:12.663 回答