-
Okay, so this rebind doesn't seem to be something as straight forward as making a simple sequence of commands via What I'm hoping to achieve is make So, for example, in kakoune I have these keybinds map global normal <a-z> 'Z'
define-command -hidden -docstring 'Add selection or refresh selections' add-sel %{
try %{
execute-keys -save-regs '' '<a-Z>a<esc><a-Z>a'
} catch %{
execute-keys -save-regs '' 'Z'
}
}
map global normal Z ': add-sel<ret>' And what that does is make |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
That issue made me realize a few parts of Dance are still not exposed (e.g. #214, #215). I'll try to work on that. With that said, using some knowledge of the internals, I came up with the following. map global normal <a-z> 'Z' is // Assign the new key binding:
{
"key": "alt+z",
"command": "dance.selections.save",
"when": "editorTextFocus && dance.mode == 'normal'"
},
// Remove the previous key binding; I believe this is optional as the new
// key binding takes precedence:
{
"key": "alt+z",
"command": "-dance.selections.restore.withCurrent",
"when": "editorTextFocus && dance.mode == 'normal'"
}, define-command -hidden -docstring 'Add selection or refresh selections' add-sel %{
try %{
execute-keys -save-regs '' '<a-Z>a<esc><a-Z>a'
} catch %{
execute-keys -save-regs '' 'Z'
}
}
map global normal Z ': add-sel<ret>' is {
"key": "shift+z",
"command": "dance.run",
"args": {
"input": [
"const registerApi = await run(`return register`),",
" registerName = register.name !== 'null' ? register.name : '^'",
" registerSelections = await registerApi.selection(registerName);",
"if (registerSelections.length > 0)",
" Selections.set([...Selections.current(), ...registerSelections]);",
"await command('.selections.save', { register: registerName });",
],
},
"when": "editorTextFocus && dance.mode == 'normal'"
},
// Again, this is probably optional:
{
"key": "shift+z",
"command": "-dance.selections.save",
"when": "editorTextFocus && dance.mode == 'normal'"
}, Note that as #214 states, we can't access the |
Beta Was this translation helpful? Give feedback.
That issue made me realize a few parts of Dance are still not exposed (e.g. #214, #215). I'll try to work on that. With that said, using some knowledge of the internals, I came up with the following.
is