Skip to content

Instantly share code, notes, and snippets.

@romainl
Last active November 13, 2024 12:03
Show Gist options
  • Save romainl/1f93db9dc976ba851bbb to your computer and use it in GitHub Desktop.
Save romainl/1f93db9dc976ba851bbb to your computer and use it in GitHub Desktop.
Vim: available key pairs in normal mode…

Vim: available key pairs in normal mode

All lowercase

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

All UPPERCASE

[WIP]

ZA ZB ZC ZD ZE ZF ZG ZH ZI ZJ ZK ZL ZM ZN ZO ZP ZR ZS ZT ZU ZV ZW ZX ZY

Mixed case

[WIP]

@jchros
Copy link

jchros commented Dec 2, 2022

I don't think that cv, dv and yv are available since operators can be followed by v to make the motions they operate on linewise/charwise. vc, vd, vp, vr, vs, vu, vx and vy aren't available either (they're operators used in visual mode), and can be useful when preceded by a count (since that selects count times as many characters as the previous selection in the same visual mode).

@romainl
Copy link
Author

romainl commented Dec 3, 2022

@jchros all good points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment