rio icon indicating copy to clipboard operation
rio copied to clipboard

Ability to overwrite / uninstall keybindings

Open mt-inside opened this issue 1 year ago • 4 comments

Similar to #419 - currently adding a keybinding with the same keys as a built-in one doesn't replace it, it seems to add it to a list. I can see why this behaviour is useful, but I also think the ability to override built-ins in a must. I also plain want to remove some built-in ones, like cmd+W on the mac - just closes the window without confirmation, bang, work gone! It's so easy to hit it when you're going for Ctrl+W (readline delete word). I've lost so much work I've nearly stopped using Rio.

Maybe the solution is a config command that clears the current action(s) for a key { key = "w", with = "super", action = "Clear" }

I then have maximum flexibility to:

  • Remove built-in binding, leaving key combo doing nothing
  • Remove built-in and add one or more of my own instead
  • Add my own on top of the built-in

I someone wanted to build the partial feature quickly, just changing the behaviour to overwrite (maybe a config option for this) would let me re-configure cmd+W to type "idiot" or something for now 😅

mt-inside avatar Feb 23 '24 10:02 mt-inside

Hey @mt-inside thanks for the issue,

Actions None or ReceiveChar doesn't fit for your case? https://raphamorim.io/rio/docs/key-bindings#overwriting

raphamorim avatar Feb 23 '24 11:02 raphamorim

Regarding the configuration, if you don't use tmux or similar you can use navigation as plain https://raphamorim.io/rio/docs/navigation#plain

raphamorim avatar Feb 23 '24 11:02 raphamorim

Hey @mt-inside thanks for the issue,

Actions None or ReceiveChar doesn't fit for your case? https://raphamorim.io/rio/docs/key-bindings#overwriting

Thanks for the reply!

Action="None" does indeed remove the keybinding. This is great, just what I needed, dunno how I missed that part of the docs.

However I think the docs are a little wrong. Because I hadn't seen Action=None, I was using text="Idiot" just to try to have something intercept Super+W and do something other than close the window. That does add to the existing binding - if I have Rio running tmux, and press Super+W, bang the window's gone, and when I reattach to that tmux, there's the text "Idiot". Is it possible that the overwrite behaviour is matching all three fields (key, with, and action) rather than just key and with ?

mt-inside avatar Mar 15 '24 16:03 mt-inside

Regarding the configuration, if you don't use tmux or similar you can use navigation as plain https://raphamorim.io/rio/docs/navigation#plain

Ah cool, I'd missed that too. Do "tabbing" keybindings include Super+Q and Super+W though? I'm fine now because I have the action=None solution, but probably worth clarifying in the docs.

mt-inside avatar Mar 15 '24 16:03 mt-inside

Do "tabbing" keybindings include Super+Q and Super+W though?

Yes! :D but you can disable with None

Closing this issue for now, sorry for late reply!

raphamorim avatar Aug 03 '24 09:08 raphamorim