1

Occasionally, I map a group of related actions (usually related to a plugin) to a group of key combinations.

I try to use some mnemonics to ease remembering it. For instance, I added 3 mappings for overseer plugin (qr, qt, qa) for (Run, Toggle and Quick Action respectively).

When I do that I need to identify which key combinations "are not used" first. The question is if there is a way to identify a group of "not used key combinations" that can be used to map a new set of actions. (*A) (*B)

*A: Is not that I have too many use combinations, but sometimes the existing combinations are embedded in muscle memory, and do not realize that are used until seeing its definition

*B: Understanding that there is an infinite key combination, the intention is to the X most recommended.

Kind of the opposite of this question: In NeoVim/Vim, how to know all used key combination?

Gonzalo Matheu
  • 8,984
  • 5
  • 35
  • 58
  • 1
    use leader key for custom mappings. is best for leader key as it can be reached with both hands – balki Jun 13 '23 at 14:43
  • Wise. I still not get used to it... apart from that, I'm left-handed, and the way, I put my hands (probably not the best and not symmetrical) is not straightforward to reach the space bar with my right hand. – Gonzalo Matheu Jun 13 '23 at 17:42

1 Answers1

3

Well, the one you gave as example are actually not available: qr, qt, qa, unless you are OK with losing the ability to record macros into registers r, t, and a.

I've maintained a list of such available pairs for a while.


The operators c, d, and y expect a motion, like w, e, etc. The second character in the following pairs is not a motion so it is a NOP and nothing is overridden if we use them in mappings.

   cd cm co cp cq cr cs cu cx cy cz
dc    dm       dq dr ds du dx dy dz
yc yd ym yo yp yq yr ys yu yx yz

v is not an operator but it has similar semantics. There are fewer available pairs, though, because it is possible to use an operator right after v.

vm vo vq vv vz

Vi didn't have anything assigned to g so Vim kind of treated the namespace as a dumpster for new two-characters commands. Here are the pairs that are left:

gb gc gl gs gy

z was free, too, and it got the same treatment, with an even worse outcome:

zq

NOTE: The comments in the gist are also worth reading.

NOTE: gs is in the list because I think it is useless. YMMV.

romainl
  • 186,200
  • 21
  • 280
  • 313
  • Well... this is an awesome example. I use macros very thoroughly without thinking about the shortcut. I didn't see that was for that until you mentioned it. – Gonzalo Matheu Jun 08 '23 at 18:37