KeyChord

Key-chord lets you bind commands to combination of key-strokes. Here a “key chord” means two keys pressed simultaneously, or a single key quickly pressed twice. (*)

The same keys used by their own (or with other keys not defined as key chords) retain their original command bindings.

There are some info and examples in the elisp-file.

(*) (In other emacs related texts, pressing SHIFT and/or META plus another key is sometimes call a “chord”, but not here. However SHIFT plus two normal keys might be a “key chord”.)

DavidAndersson


A thumb is a finger of the strongest! Let’s utilize a thumb. Small hack to define a key-chord starting with Space. Add (key-chord-mode 1) to your .emacs file to activate parent mode.

Lisp:space-chord.elrubikitch

Love key-chord! here’s a setup to use keychord and viper mode more seamlessly - toggle-viper-keychord. – ipstone

key-chord and space-chord both looked interesting to me. space-chord didn’t seem to want to work at all, but I didn’t investigate that at all.

key-chord seems to pick up my typing as chords. I tried setting key-chord-two-keys-delay and key-chord-one-key-delay to lower values. I halved them a few times, I had key-chord-two-keys-delay down to 0.0125. Maybe I just type too fast, or maybe the effective delay can only go so low.

PatRegan

Pat: I would recommend you avoid combinations that are even slightly common in your writing (prose or programming). See the “Tips” commentary in the source. When you have decided on a candidate (“xy”), check it on your own texts with this command (on any non-windows computer):

 egrep -R --include='*.txt' --include='*.cc' 'xy|yx' .

DavidAndersson

If you use german, here are some you could check (rare letter combinations): dp, dv, gw, hu, ms, mt, rw, fg, fw, hp, iy, sv, hö, bf, bh, bp, cd, cf, cg, cp, cq, cv, cw, cy, dc, dm, fb, fc, fm, fy, fz, gc, gm, gy, hb, hy, hz, iq, md, mf, mg, mv, mw, nx, pb, pc, pz, qc, qi, qr, qt, rq, sx, sz, tq, uu, uv, vc, vm, vu, vy, wc, wm, ww, wy, xn, xs, yc, yf, yg, yh, yv, yw, yy, zh, zp, zs, ,a, ,b, ,c, ,i, ,m, ,o, ,u, ,x, ,y, ,z, ,ä, ,ü, .a, .b, .c, .i, .m, .o, .u, .x, .y, .z, .ä, .ü, a,, a., aj, aq, aß, b,, b., bd, bj, bk, bq, bv, bw, c,, c., cj, cß, db, dq, dx, dz, dä, dö, dü, fq, fv, fx, fö, gq, gx, gz, gä, gü, hx, i,, i., ij, ja, jb, jc, ji, jm, jo, jr, jt, jx, jy, jz, jä, jü, kb, kx, ky, kz, kä, kü, lx, lz, lö, lü, m,, m., mj, mq, mß, o,, o., oj, oq, ox, oä, pq, pä, pö, pü, qa, qb, qd, qf, qg, qm, qo, qp, qs, qw, qx, qy, qz, qä, qü, rj, rß, sq, sä, sö, tö, u,, u., ux, vb, vf, vg, vx, vz, vä, vö, vü, wb, wq, wx, wö, x,, x., xd, xf, xg, xh, xj, xk, xl, xo, xq, xu, xv, xw, xy, y,, y., yj, yk, yq, yx, yß, z,, z., zc, zd, zf, zg, zj, zk, zl, zq, zv, zz, ßa, ßc, ßm, ßr, ßy, ä,, ä., äd, äg, äj, äk, äo, äp, äq, äs, äv, öd, öf, öl, öp, ös, öt, öv, öw, ü,, ü., üd, üg, üj, ük, ül, üp, üq, üv, ,,, ,q, ,ö, .w, .ö, bß, cz, cö, fj, gv, iä, jf, jg, jö, kd, kk, kq, nq, oü, q,, qö, tj, vw, w., wv, xß, xö, xü, yä, zx, zß, ßb, ßd, ßt, ßx, ßz, ßä, ßö, äa, äy, äß, ää, ö,, ö., öc, öj, öq, öx, öß, öö, üo, üx, ,w, .q, aä, bb, bz, dk, dß, fß, gj, hh, iü, kv, lq, oö, pw, qk, ql, qn, qq, rx, sß, tß, vk, vv, w,, wp, xx, xz, zb, ßf, ßg, ßs, äi, äö, öo, öä, üi, üm, üä, kf, äx, ,., .,, äü, xr, pv, vp, mü, jj, fk, öi, q., gß, xä, p,, yü, iö, üy, ,p, ßß, v,, hq, qh, cx, xc, ,v, mx, öü, üa, jv, vj, aü, lj, üö, ßv, jl, xm, vß, jh, ßj, jß, öu, hj, zy, lß, ßh, nj, kj, yz, jk, ßl, jn, öy, yö, hß, uö, zä, ßn, nß, j,, jp, pj, äz, ,j, äb, bä, ß,, ßk, kß, jw, ,ß, wj, ßp, pß, .v, v., k., .k, ßw, wß, zü, k,, öb, bö, üz, üu, ,k, uü, ,f, f,, j., .j, vq, bx, qv, zo, xb, oz, ß., öa, .ß, aö, jq, qj, ßq, qß, kw, wk, zö, öz,

ArneBab

Arne: I would recommend you avoid combinations that are even slightly common in your writing (prose or programming). Even very infrequent clashes can be very irritating. I am not fluent in german, but the above list match a lot of not so uncommon words: sozial, zogen, Schulz, plötzlich, Major, Jahre, Kaufmann, Umfang, Segment, GmbH, Wolfgang, sorgfältig, erwarten, Verwaltung, bestimmt, Erstmal, Samstag, Ministeriums, Schule, ruhig, and many hundreds more. And sorry to say, the letter+dot and letter+comma is just stupid. I have also seen other examples where key-chord is used with way to common letter pairs. Please check your texts thorolly before chosing chords. – DavidAndersson

If, like me you need to undefine a key chord and key-chord-unset-global does not help, try the following:

(defun alf/key-chord-undefine (keys)
  "Undefine the key chord identified by KEYS.
This should be done by key-chord-unset-global, however that
does not work for me."
  (let ((key1 (logand 255 (aref keys 0)))
        (key2 (logand 255 (aref keys 1))))
    (if (eq key1 key2)
        (global-unset-key (vector 'key-chord key1 key2))
      ;; else
      (global-unset-key (vector 'key-chord key1 key2))
      (global-unset-key (vector 'key-chord key2 key1)))))

– Alf Lervåg

This is amazing! But I have to point out one negative effect… When I started learning emacs, I was frustrated by all of the weird key combinations I had to use. It felt very uncomfortable so I started searching for a solution and found KeyChord. Since then I was mapping every command to chords if I used it at least once in two days. It feels great!

However, I have a real tough time when I’m not using my config (for example, if something went wrong and my config failed). I barely remember how to open a file in pure emacs. And I always imagine someone standing behind me and looking how I type “how to save a buffer in emacs” into the search engine… So embarrassing!

--AlexDaniel?


CategoryKeys