Show a message if I use a mouse for something that I could do with a keyboard shortcut

358 Views Asked by At

On PyCharm there is a plugin (Keyboard Promoter) that pops up a little window on the bottom with something like "keyboard shortcut missed (1) time" if you, for example, use the mouse for something that has a keyboard shortcut:

enter image description here

Is there an analogous feature in VS Code, so that I can get used to using shortcuts without actually going over the list of them?

1

There are 1 best solutions below

2
starball On

Check the extension marketplace. For example, donebd.vscode-keypromoter sounds like it could be what you want (I have no affiliation with this extension). Actually, the way it appears to work is pretty interesting, and I'm surprised VS Code would allow it to work at all (in my initial revision of this answer post, there was no mention of this extension. I only found out it exists because someone else pointed it out. I didn't even try to search for an extension because I assumed that VS Code would protect its own builtin commands from being overridden like this extension is doing). Not everything can be listened to the way this extension is doing things (a bunch of extension-specific commands- even for builtin extensions, (such as the git builtin extension) which you can see in its output channel if you set its logging level to "Debug")

Failing that, the majority of mouse actions in VS Code have corresponding keyboard-shortcut-bindable commands. It's pretty practical to just assume that what you're doing has a bindable command, search for what that command is, learn what its default binding is, or create a binding, or adjust the binding how you like.

You can search for commands in the keyboard shortcut editor, which you can open from the command palette using Preferences: Open Keyboard Shortcuts. See also related docs. If you want to get a full list of currently bound keybindings, see Is there an easy way to access the Display name (title) of each command listed in the Keyboard Shortcuts JSON file?. If you want to know all the default keybindings, use the defaultSettings.json pseudo-file, which you can open using Preferences: Open Default Keyboard Shortcuts (JSON) in the command palette. All you need is to have some basic terminology knowledge (which you can get by reading docs (Ex. UI basics docs, editor basics docs)- yes, I just said that), and then you can just search for what you want and pretty easily find it. FYI, you may find it easier to first search for commands through the command palette and then use the keyboard shortcut editor, since the command palette supports a form of semantic fuzzy matching.

Lastly, my unsolicited personal experience / 2 cents: I mostly don't bother trying to learn a bunch of keybindings. There's a small set of keybindings I do know by heart because I use them so much, but I mostly just use the command palette. It's hard for me to remember keybindings, and easier to just remember the names of commands I want to invoke. It costs a bit in time / hand movement, but it saves a lot of mental / memory burden. I just have an easy to reach command palette binding, and remap my keyboard at a system level to make it easier to reach modifier keys and navigation keys.