VSpaceCode/vspacecode.github.io

customize major mode bindings

grozan opened this issue · 2 comments

Bug description

I see in the documentation that I can use vspacecode.bindingOverrides to customize existing bindings, or add new ones in a menu. It works great for "simple" bindings, but I can't manage to find the right syntax to customize a major mode-specific binding.

Example: I want to change the command used to toggle text to bold, only in markdown major mode.
I want all the other markdown-specific bindings to stay like they are, I just want to modify m x b for example (only for markdown, that is)
Is it possible?

You should able to use the follow example to override

"vspacecode.bindingOverrides": [
    {
        "keys": ["m", "languageId:markdown", "x", "b"],
        "name": "Blame",
        "type": "command",
        "command": "gitlens.toggleFileBlame"
    }
]

The major mode is using conditional bindings feature in which-key which is described in https://vspacecode.github.io/docs/extra#conditional-bindings-experimental

An improvement on top of my head, we update the doc of the major mode to point people to the conditional bindings section.

yes, it's working, great!
thanks a lot for the quick reply