2 actions - 1 keybinding #37873
FloppyDisco
started this conversation in
Config, Settings and Keymaps
Replies: 3 comments 2 replies
-
|
I like this idea, I'll see if I can get something rough implemented over the next day or so to see how it might work |
Beta Was this translation helpful? Give feedback.
2 replies
-
|
this is great. feels intuitive and looks like it is working as expected! |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
While my exact PR wasn't merged, this feature did get added! @FloppyDisco |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
unless i am missing something.
there is not currently a way to have one keybinding execute a sequence of actions.
i see a comment about this in #30410
workspace::SendKeystrokesis a pretty grossly inadequate workaround.for
SendKeystrokesto work the secondary action i want to do must be defined with a keybinding in the current scope.AND the secondary action must be doing something in the same scope.
for instance, i can use
because both of them are already keybindings in my editor context, and both actions involve the editor.
however
lets say i want to search the selection in the editor.
{ "context": "Editor && mode == full", "bindings": { "cmd-f" : "buffer_search::Deploy", } }, { "context": "BufferSearchBar > Editor", "bindings": { "cmd-alt-l": "search::ToggleSelection", } },i have to press
⌘Fand then⌘⌥Lhowever i would like to do this with one keybinding.
if i set
it does not work because
⌘⌥Lis trying to do something in a different scope.essentially.
SendKeystrokes sends everything to the same context. instead of switching context between each keystroke if the keystroke happens to change the context or 'Focus'.
To me being able to pass an actual 'action' instead of a 'keystroke' is a bug, not a feature request.
just some thoughts on it:
there are currently multiple ways to pass an action and arguments.
having multiple ways is confusing and limiting, particularly because you are using an array.
from the docs:
so:
My hunch would be that trying to accommodate this syntax is making it harder to figure out how to support multiple actions... lol.
The array should be used for passing a sequence of actions. not for arguments.
the different syntaxes are necessary for passing different types of arguments, either named, or positional, but i think my suggestion would be to make all actions either a
Stringor anObjand if the arguments need to be positional or named, make the "args" parameter either a list or an object. that is where it makes sense.then you could use the array for sequences of actions and the actions could either be strings or objects, based on the needs of the particular action.
this is more or less how commandsCommands extension works for vscode.
and to me it feels alot more intuitive.
separate question.
anyone know if there is an action to deploy the buffer_search with search selection already on? lol.
Beta Was this translation helpful? Give feedback.
All reactions