#4153

Please make typing 'bind [keybind]' print the command it executes.

Openzulc22opened 3mo ago

Description

I know this UI choice from Source Engine based games; when I was reading through the docs and couldn't figure out how to rebind a key that was already bound to something else, this choice not being a part of Micro frustrated me quite a bit.

You could check ~/.config/micros/bindings.json for binds the user set, but I couldn't find a list of default binds and their associated commands.

I would expect something like this:

> bind Ctrl-c
"Ctrl-c" = "copy"

Activity

5
usfbih8u3mo ago

Using > help commands you can find these:

  • showkey 'key': Show the action(s) bound to a given key. For example running > showkey Ctrl-c will display Copy.

  • bind 'key' 'action': creates a keybinding from key to action. See the keybindings documentation for more information about binding keys. This command will modify bindings.json and overwrite any bindings to key that already exist.

Using these you will see defaults keybindings:

> help defaultkeys > help keybindings

usfbih8u3mo ago

Using > help commands you can find these:

  • showkey 'key': Show the action(s) bound to a given key. For example running > showkey Ctrl-c will display Copy.

  • bind 'key' 'action': creates a keybinding from key to action. See the keybindings documentation for more information about binding keys. This command will modify bindings.json and overwrite any bindings to key that already exist.

Using these you will see defaults keybindings:

> help defaultkeys > help keybindings

kaitlynia3mo ago

I think this issue has merit, especially if it's ephemeral (displayed only until next input)

kaitlynia3mo ago

I think this issue has merit, especially if it's ephemeral (displayed only until next input)

zulc222mo ago

It is true that micro doesn't need a new feature to do this, but I think this would compliment what makes micro better than Vi-based editors.

I think that at the very least, it is worth considering mentioning showkey ASAP in the getting started docs; the ability to experiment and just 'guess' how you're supposed to use this editor is great compared to other lightweight terminal-based editors, and I think this would enhance that.

That's why Ctrl-s and Ctrl-q are bound like that already, right? They're well-known. Any seasoned computer user would just guess that's how you do it, this whole bind-thing has almost as much heritage as those keybinds, in the gaming and gamedev community.

(to my knowledge) It originated in Quake (1996), it got copied to GoldSrc [HL1, CS1.6] (1998~2003), Source [Garry's Mod, CS:GO, HL2, The Stanley Parable ...] (2004~2013), ZDoom backported it into their Doom-based game engine [GZDoom, LZDoom, UZDoom] (1998~present), and that exact syntax still persists in the latest games coming from Valve in Source 2 (2020~present).

It's actually hard for me to imagine that micro's existing bind command wasn't inspired by it... Despite how I could imagine someone stumbling into something so simple, it does share exactly the same syntax; bind 'key' 'action', bind <key> 'command'. bind 'key' not being equivalent to showkey 'key' breaks that convention.

(I also wonder why there's not an alias for, perhaps, the verb 'getbind' to showkey, too?)