首页 > 解决方案 > Vim Ctrl-] 不起作用,那么我该如何重新映射它的功能呢?(视窗 10)

问题描述

今天我安装了一个最近的 64 位 Gvim:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Dec 13 2020 23:02:22)
MS-Windows 64-bit GUI version with OLE support
Included patches: 1-2143
Compiled by appveyor@APPVYR-WIN
...

我曾经是一个 vimer,但很久以前就切换到 emacs 和 evil-mode。我正在调查我是否应该回到vim,所以......

奇怪的是,Ctrl-]关键在 vim 中扮演死人。它不会跳转到光标下的标签,当我按下那个键时没有任何反应,根本没有反应。

跳转到带有的标签<C-LeftMouse>确实有效。

物理密钥确实有效。当我向 Emacs 询问这个密钥时,它回答:

C-] runs the command abort-recursive-edit (found in global-map), which
is an interactive built-in function in ‘C source code’.

It is bound to <menu-bar> <minibuf> <quit>, C-], C-}.
 
(abort-recursive-edit)

Abort the command that requested this recursive edit or minibuffer input.

我还检查了使用key history toolin an autohotkey script: theCtrl和 the]都被正确跟踪。

为了验证我是否在尝试 vim 的短时间内创建的小脚本.vimrc和脚本中引起了问题,我在没有初始化文件的情况下运行了 vim 和 gvim:.gvimrc

vim -u NONE -U NONE
gvim -u NONE -U NONE

同样的问题,钥匙不起作用。

昨天我不小心安装了最新的官方 32 位 windows 安装程序(我今天将其删除并替换为这个 64 位版本)。我确实在新安装的 gvim 的第一次运行时遇到了这个问题,但推迟了对它的研究,直到我的python 支持问题得到适当修复(感谢filbranden)。

所以它出现在 32 位和 64 位版本中,去看看......

但这真的很不幸,每当我想跳转到帮助标签之一时,我都不想抓住鼠标。

当然,我想了解并解决这个问题。但只要没有修复,我想将功能重新映射到另一个键,但我不知道该怎么做。

任何解决原始问题或重新映射标签跳转功能的帮助将不胜感激。

提前致谢, 圭多

标签: vim

解决方案


It should be easy enough to remap this particular combination like any other, to permanently set the binding add the following line to your vimrc:

nnoremap <C-]> :command-you-want<CR>

Typically, the command you are looking for is :ta which can be mapped like so:

nnoremap <leader>t :ta<CR>

You should be able to map it to whatever your Left Click is doing as well. If you check in :help index it should show you your current bindings. For me both C-LeftMouse and C-] are doing :ta I suspect your C-] isn't for some reason. You can try setting it to that manually as in the above example.

Personally I have a baked potato for a hippocampus and find I forget more advanced bindings all the time so i keep :help index bound to F1.


推荐阅读