Emacs Keys: Set Key to Insert Unicode Emoji
Set a key to insert unicode char
Here's the best way to set a key to insert Unicode: Emoji π or Unicode: Math Symbols ΟΒ² β β« .
put this in your Emacs Init File:
;; F8 insert bullet char (define-key key-translation-map (kbd "<f8>") "β’")
Here's how to set a key sequence to insert different Unicode characters.
;; set keys to insert math symbol (define-key key-translation-map (kbd "<f5> p") "Ο") (define-key key-translation-map (kbd "<f5> x") "ΞΎ") (define-key key-translation-map (kbd "<f5> i") "β") (define-key key-translation-map (kbd "<f5> <right>") "β") ;; set keys to insert emoji (define-key key-translation-map (kbd "<f5> 1") "π ") (define-key key-translation-map (kbd "<f5> 2") "β€")
π WARNING: Problem Using global-set-key
You could also use global-set-key
, but it has problems.
;; this won't work when in isearch (global-set-key (kbd "<f8>") (lambda () (interactive) (insert "β")))
When you do interactive search Ctrl+s, then when you type your key, it'll exit the search instead of inserting the char.