Visual Studio Code sets various context keys and specific values depending on what elements are visible and active in the VS Code UI. These contexts can be used to selectively enable or disable extension commands and UI elements, such as menus and views.
These contexts can be used by extension creators or end-users.
Personally I use them to create keyboard shortcuts, here are two examples:
I think this is a very useful feature to create powerful keyboard shortcuts that are focused.
I dove a bit further into the topic of keyboard shortcuts in Obsidian and it seems like it doesn’t currently expose any keybindings.json or similar file for keyboard shortcuts. Probably that feature would need to be built first.
and a keybinding
{
“key”: “ctrl+shift+v”,
“command”: “editor.action.insertSnippet”,
“args”: {
“name”: “print wrap copy plus”
},
“when”: “editorTextFocus”
},
and a shortcut as
but let’s get back to obsidian.
for instance before you could do ctrl + enter to toggle bullet in the editor
now if you add it, it’s telling that’s in conflict. but the other ctrl enter should be working anyway because it’s on tabs. so obviously context is IMPORTANT
E.g.
I can’t assign the same shortcut to rename a file and a heading.
Ideally the action should compose nicely within the context.
However, having a focus context (Files vs Editor) should work and it should be as simple as changing the shortcut priority (sorting) based on context.