diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-08-23 17:16:44 +0100 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2020-08-23 17:16:51 +0100 |
commit | 79f8265815fd72dd2dca1ad16bd7597ef2e75119 (patch) | |
tree | 7ae47a4c31c08384f70bd78835ec6978ba4d300b /Emacs/.config/emacs/config.org | |
parent | 9b0c50fc7c08bb2390aac36e76a04e3151f9ba31 (diff) | |
download | dotfiles-79f8265815fd72dd2dca1ad16bd7597ef2e75119.tar.gz dotfiles-79f8265815fd72dd2dca1ad16bd7597ef2e75119.tar.bz2 dotfiles-79f8265815fd72dd2dca1ad16bd7597ef2e75119.zip |
+pretty symbols to core packages
Diffstat (limited to 'Emacs/.config/emacs/config.org')
-rw-r--r-- | Emacs/.config/emacs/config.org | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Emacs/.config/emacs/config.org b/Emacs/.config/emacs/config.org index 6af96f9..62cf9e7 100644 --- a/Emacs/.config/emacs/config.org +++ b/Emacs/.config/emacs/config.org @@ -568,6 +568,58 @@ just setup some evil binds for company ("M-j" . company-select-next) ("M-k" . company-select-previous))) #+end_src +** Pretty symbols +Prettify symbols mode allows for users to declare 'symbols' that +replace text within certain modes. For example, you may replace the +'for' word in c-mode in trade of '∀'. Though this may seem like +useless eye candy, it actually increases my speed of recognition +(recognising symbols is easier than words for many, including +me). + +Now here I provide a macro +pretty/set-alist. This macro works pretty +simply: given a mode hook, as well as a list of pairs typed (text to +substitute, symbol to replace with). Then I add a hook to the given +mode, setting the prettify-symbols-alist to the symbols given. + +I've declared it pretty high up into my config so that the rest of my +packages can leverage it. + +#+begin_src emacs-lisp +(use-package prog-mode + :straight nil + :init + (setq prettify-symbols-unprettify-at-point t) + :config + (defmacro +pretty/set-alist (mode &rest symbols) + `(add-hook + ',mode + (lambda () + (setq prettify-symbols-alist ',symbols) + (prettify-symbols-mode)))) + + (defun +pretty/set-alist-f (mode symbols) + `(+pretty/set-alist mode ,@symbols))) +#+end_src + +Here's a collection of symbols I have currently that may be used +later. +#+begin_example +("null" . "∅") +("list" . "𝕃") +("string" . "𝕊") +("true" . "𝕋") +("false" . "𝔽") +("char" . "ℂ") +("int" . "ℤ") +("float" . "ℝ") +("bool" . "𝔹") +("!" . "¬") +("&&" . "∧") +("||" . "∨") +("for" . "∀") +("return" . "⟼") +("lambda" . "λ") +#+end_example Use hydras for stuff that I use often, currently buffer manipulation #+begin_src emacs-lisp (use-package hydra |