Emmet keyboard shortcuts not working in vscode - visual-studio-code

I'm not talking about the abreviations (which works fine); but rather keyboard shortcuts.
Like this one for instance, Ctrl+k is supposed to remove a tag(opening and closing) and re-arrange the inner HTML's indentation.
This is just one example, but most shortcust found in emmet's page, doesnt work on vscode, why is that ? how can I fix it ?

If you look at the Keyboard Shortcuts page and search for emmet you will see many emmet commands unbound to a keybinding. Including
editor.emmet.action.removeTag
[I think there are just too many emmet commands for vscode to have devoted keybindings to them when most people wouldn't use them.]
If you hover over any command and click on the + sign to its left vscode will open an input box where you can enter your desired shortcut keybinding.
I wouldn't recommend Ctrl+K as that is used as a part of a lot of default keybindings in vscode.

Related

Can I see, and individually disable, keyboard shortcuts for extensions, such as the Sublime Text Keymap extension?

When I started using VS Code, I installed the "Sublime Text Keymap and Settings Importer" extension, to make it act more like Sublime, because that is what I was familiar with.
Now, I would like to use the default shortcuts. I want to switch gradually, maybe by disabling a few Sublime shortcuts at a time, or by at least knowing which shortcuts are coming from the Sublime extension, so I can train myself to stop using them.
Is there any easy way to see which shortcuts are coming from the Sublime extension, and ideally disable some, but not all, of them?
If I look at the "Keyboard Shortcuts" list, it shows the default shortcuts and the Sublime shortcuts mixed together, with no hint as to which is which, as far as I can tell. Example:
It shows both Command+P and Command+T as shortcuts for workbench.action.quickOpen, both with a source of "Default". But I know that Command+T is coming from the extension, because if I disable the extension, I don't see it (but I still see Command+P). Disabling the extension and restarting VS Code is kind of inconvenient, so I would like an easy way to see which shortcuts are coming from the extension.
You can see a comprehensive list of all keybindings the extension includes in the "Contributions" tab of the extension itself:
I'm not aware of any options to display this in the keyboard shortcuts UI directly. However, you could put the two tabs side-by-side for easy comparison:
Here is an updated and better method to filter the Keyboard Shortcuts editor to show which keybindings are contributed by a specific extension. See Specify which extension provides a specific keyboard shortcut. And here is an example where I search for one of my extensions, Toggle Line Comments to see if it contributes any keybindings.
And then it would be easy to disable or re-bind any of those keybindings.
Also you can click on the Extension gear icon in the Extensions list. That will bring up a menu with an Extension Keyboard Shortcuts option. Which will open the Keyboard Shortcuts editor with a search already completed for any keybindings contributed by that extension.
Keep an eye on this PR https://github.com/microsoft/vscode/pull/95713 (Show keybinding source in GUI). Looks like it may be included in vscode v1.45. It would allow you to filter the "Keyboard Shortcuts" by user-defined or extension. From the above link:
Filters examples:
#user - shows user defined keybindings
#default - shows default keybindings
#extensions - shows all extension contributed keybindings
#extensions:"${EXTENSION_NAME}" - shows keybindings contributed by
${EXTENSION_NAME}
#extensions:${EXTENSION_NAME} - same as above only without quotes
(spaces are invalid for this one)
Searching with filter and text also works:
#extensions:bookmarks list - shows keybindings from bookmarks
extension that contain the word "list"
And then with such a filtered list it would be easy to disable whichever commands you wished.

How to find command by pressing keybinding in VSCode

I'm looking for a way for VS Code to tell me the command name for a keybinding.
In Emacs, this functionality is available under describe-key (C-h k).
For example, in VS Code ⌘ A maps to editor.action.selectAll. So ideally I'd press a keyboard shortcut, then ⌘ A, then VS Code would tell me editor.action.selectAll.
As a partial solution, I can open my keybindings.json and search for ⌘ 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.)
You can find the command associated with a key binding by typing the keybinding into the Keyboard Shortcuts search box:
Unfortunately, per the source code, the vim extension doesn't use this mechanism to bind the o key.
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"]
],
If you have the new settings UI, you might need to search for vim.normalModeKeyBindingsNonRecursive first, and then click Edit in settings.json.
As of the September 2018 release, VSCode can do this from the keyboard shortcuts window.
From the keyboard shortcuts window (cmd+k cmd+s), type cmd+option+k or click the keyboard icon on the right.
Kudos to this comment linking to this approach as an answer to another question.

Shortcut key to jump to "files to include" input in Find In Files

I use the keyboard shortcut for Find in Files (CtrlShift+F), and use other hotkeys, like Alt+R to toggle regex matching on/off (though I wish they'd used the same shortcuts as Visual Studio!
In Visual Studio you can jump to the File Types input with Alt+T, but I can't figure out a way to do it in VS Code, I have to resort to pressing Tab 5 times. Anyone know the keyboard shortcut to jump directly to that input?
New answer:
Up/down arrows now navigate the history of each search field. You can use cmd+up/down to switch between the inputs.
Original answer:
You can use the up/down arrows to switch between these inputs.
VSCode 1.70 (July 2022) adds a related feature:
Search Editor: Allow Keyboard Shortcut for File to Include/Exclude
In the search editor, there is search.action.focusQueryEditorWidget to focus on the query.
I'd like to be able to set a keyboard shortcut to focus on "files to include" and "files to exclude".
Fixed with PR 153954
This adds keybindings to quickly focus on files to include/exclude.
I tried to follow the pattern for the toggle X keybindings, so I went with:
Cmd+Alt+F and
Cmd+Alt+Shift+F.
I used "F" for "files".
This is available in VSCode insiders today.

Keyboard shortcut to cycle between opened editors in vscode

What is the keyboard shortcut Ctrl+` actually meant to do?
According to https://code.visualstudio.com/Docs/customization/keybindings, you can use Ctrl+` to "Cycle Between Opened Editors".
Viewing the vscode Explorer, I can see that there are several "working files", but pressing Ctrl+` does nothing.
I miss being able to use the "standard" keyboard shortcuts Ctrl+W or Ctrl+F6.
(Note: I found that Ctrl+Tab does the job!)
Another problem with Ctrl+` is that the symbol is not easily accessible on, for example, a Norwegian keyboard layout. What am I missing here?
When you open multiple documents side by side (Ctrl+Click in file list), this shortcut lets you switch between them.

Can macros in Notepad++ have "simple" keyboard shortcuts

I've recorded and saved two macros in Notepad++, giving them Ctrl+B and Ctrl+Shift+B shortcuts respectively. First doesn't work (does not playback macro), while second is all fine (restart doesn't help).
Can macros in Notepad++ have "simple" keyboard shortcuts, like Ctrl+B?
BTW: I'm trying to "emulate" formatting shortcuts (like bold, italics etc.), but for Markdown, not for HTML. That's why Notepad++'s plugins like "WebEdit" won't help me here.
Reworded:
You can save a macro with CTRL+B shortcut...
but you can't use the shortcut to same combination to call it back.
It think it's because it seems that key stroke is already used and your own combination is not overridding the original reserved one.
Ctrl-B Go to matching brace
It seems like a bug within notepad++ or not well documented feature.
Following mehow's answer I found the solution. Ctrl+B shortcut doesn't work for my macro, because it is used with another command.
Going (in Notepad++) to Settings > Shortcut mapper > Main menu, locating Go to matching brace command and setting its shortcut to None solved the problem. From this moment, each press of Ctrl+B calls my macro, not that previous command.