如何通过按VSCode中的按键绑定查找命令 [英] How to find command by pressing keybinding in VSCode

查看:137
本文介绍了如何通过按VSCode中的按键绑定查找命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种让vscode告诉我键盘绑定命令名称的方法.例如,cmd+a映射到editor.action.selectAll,因此理想情况下,我先按下键盘快捷键,然后按cmd+a,然后VSCode可以告诉我editor.action.selectAll.

I'm looking for a way for vscode to tell me the command name for a keybinding. For example, cmd+a maps to editor.action.selectAll, so ideally I'd press a keyboard shortcut, then cmd+a, then VSCode could tell me editor.action.selectAll.

作为部分解决方案,我可以打开keybindings.json并搜索cmd+a,但这不适用于扩展-我的特殊用例是弄清楚vim o命令的名称,因此我可以重新映射.

As a partial solution, I can open my keybindings.json and search for cmd+a, but this doesn't work for extensions - my particular use case is figuring out what the vim o command is called so I can remap it.

在Emacs世界中,此功能在describe-key(C-h k)下可用.

In the Emacs world, this functionality is available under describe-key (C-h k).

推荐答案

您可以通过在Keyboard Shortcuts搜索框中键入键绑定来找到与键绑定关联的命令:

You can find the command associated with a key binding by typing the keybinding into the Keyboard Shortcuts search box:

不幸的是,根据源代码,vim扩展程序不使用此机制来绑定 o 键.

Unfortunately, per the source code, the vim extension doesn't use this mechanism to bind the o key.

幸运的是,它确实允许您将键重新绑定到设置.首先,打开设置( F1 Preferences: Open Settings),然后添加(例如,绑定 i ):

Fortunately, it does let you rebind the keys in settings. First, open settings (F1 Preferences: Open Settings), then add (to bind i, for example):

"vim.normalModeKeyBindingsNonRecursive": [
    "before": ["i"],
    "after": ["o"]
],

如果具有新的设置UI,则可能需要先搜索vim.normalModeKeyBindingsNonRecursive,然后单击Edit in settings.json.

If you have the new settings UI, you might need to search for vim.normalModeKeyBindingsNonRecursive first, and then click Edit in settings.json.

这篇关于如何通过按VSCode中的按键绑定查找命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆