Endless Parentheses

Ramblings on productivity and technical subjects.

profile for Malabarba on Stack Exchange

Transposing keybinds in Emacs

Transposing is another of those features that I really miss when not in Emacs. It took me several months of actively reminding myself in order to finally incorporate it into my regular arsenal. Now, not a day goes by that I don’t transpose a few lines, and usually some words and sexps as well, but the usefulness of transpose-char still seems to elude me.

I hear this command is great at fixing some typos, so perhaps I don’t find it as useful because auto-correct takes care of those for me. Meanwhile, the other transpose commands have the very different role of refactoring code or moving text around (transpose-lines is specially nice with one-line-per-sentence text).

Whatever the reason, the point is that C-t is too good a key for a command that I’m not going to use and C-x C-t is too long for a command I use so often. The answer, of course, is to swap the two around.

(global-set-key "\C-t" #'transpose-lines)
(define-key ctl-x-map "\C-t" #'transpose-chars)

Tags: keybind, init.el, emacs,

comments powered by Disqus