Emacs Tips

2023-08-31 257 words 1 min read

Emacs Tips

Bind “muhenkan” key to evil-escape in Spacemacs

In vim and hybrid editing styles in Spaecemacs, you hit “ESC” key frequently to escape to “normal mode”. But “ESC” keye is far away from the home row.

In a Japanse 106 keyboard, there some unused keys:

Japanese 106 Keyboard

図1: Japanese 106 Keyboard

So bind “muhenkan” key (lett to the spacebar) to =evil-escape" to espcape to normal mode.

Add this to your Emacs configuration:

(define-key global-map (kbd "<muhenkan>") 'evil-escape)
ソースコード 1: Bind "muhenkan" key to =evil-escape"

If you do not use a Japanese keybord, please replace “<muhenkan>” with the key you want to use.

That’s all. Enjoy!

TODO Bind “Henkan” key to set shift key in Emacs

This means that if you hit “Henkan” key, then hit “s”, then you get “T”.

For example:

  • Henkan t → T

This is for Japanese 106 only.

To bind “Henkan” to enter “Shit”, Write this in you Emacs configuration. Replace 'henkan to the key you want to use:

(let ((i ?a))
  (while (<= i ?z)
    (define-key key-translation-map
      (vector 'henkan i) (vector (- i 32)))
    (setq i (1+ i))))
(setq x-meta-keysym 'meta)
(setq x-super-keysym 'meta)
ソースコード 2: "Henkan" key to set shift key

That’s all.

Enjoy!

(let ((i ?a))
  (while (<= i ?z)
    (define-key key-translation-map
      (vector 'muhenkan i) (vector (- i 32)))
    (setq i (1+ i))))
(setq x-meta-keysym 'meta)
(setq x-super-keysym 'meta)

Tags: Emacs

We notice you're using an adblocker. If you like our webite please keep us running by whitelisting this site in your ad blocker. We’re serving quality, related ads only. Thank you!

I've whitelisted your website.

Not now
This website uses cookies to ensure you get the best experience on our website. Learn more Got it