1

I like the idea of xcape for exiting insert-mode by just quickly tapping Control_L, but I don't like how it leaves "unconsumed" escapes around in other modes, or in other programs/terminals, which mess up my flow.

(E.g. input is xargs █oldcommand and I'm about remove oldcommand with C-k, so I hit Control_L, then change my mind because I want to type "bash -c" first, but because of the escape that turns into M-b ash -c leaving me with ash -c█xargs oldcommand instead of xargs bash -c█ oldcommand.)

Can Emacs itself handle lone modifier keypresses so I can have this only in evil insert-mode?

1

I found a workaround, inspired by the comment by Håkon Hægland in Leave evil insert mode with control key

First make a keycode for VoidSymbol with xmodmap (xcape can only work on keysyms that have assigned keycodes), then let xcape map Control_L to that instead of Escape:

xmodmap  -e 'keycode 255 = VoidSymbol'
xcape -t 175 -e 'Control_L=VoidSymbol'

Then just

(define-key evil-insert-state-map (kbd "<VoidSymbol>") 'evil-normal-state)
(define-key evil-visual-state-map (kbd "<VoidSymbol>") 'evil-normal-state)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.