#+TITLE: Interface #+AUTHOR: Christopher James Hayward #+EMAIL: chris@chrishayward.xyz #+PROPERTY: header-args:emacs-lisp :tangle interface.el :comments org #+PROPERTY: header-args:shell :tangle no #+PROPERTY: header-args :results silent :eval no-export :comments org #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil #+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[../docs/images/what-is-emacs-teaser.png]] *Bring Emacs out of the eighties* * Menu completion There's a lot of occasions Emacs asks to input text to match a file name in a directory, just one example of an oppertunity for a completion system. *Swiper*[fn:1] is a family of packages that work towards this common goal in Emacs. ** Selection menu *Ivy*[fn:1] is a powerful selection menu for Emacs. #+begin_src emacs-lisp (use-package ivy :diminish :config (ivy-mode 1)) #+end_src ** Popup selection frame + Display =ivy= completions in a popup buffer + Set ~parent-frame~ to =nil= for [[file:desktop.org][Desktop]] support #+begin_src emacs-lisp (use-package ivy-posframe :after ivy :when (window-system) :custom (ivy-posframe-display-functions-alist '((t . ivy-posframe-display))) (ivy-posframe-parameters '((parent-frame nil))) :config (ivy-posframe-mode 1)) #+end_src ** Replace built in commands *Counsel*[fn:1] is a customized set of commands to replace built in completion buffers. #+begin_src emacs-lisp (use-package counsel :after ivy :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only) :config (counsel-mode 1)) #+end_src *** Switch buffers with , Cherry picked from =doom=. #+begin_src emacs-lisp (dotfiles/leader "," '(counsel-switch-buffer :which-key "Buffers")) #+end_src ** Additional details Provide more information about each item in the completion menu with *Ivy rich*[fn:2]. #+begin_src emacs-lisp (use-package ivy-rich :after counsel :init (ivy-rich-mode 1)) #+end_src * Unified fonts Write out to all of Emacs' available font faces with the unified font defined in the options. #+begin_src emacs-lisp (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size) (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size) (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size) #+end_src ** Text scaling Define a transient keybinding for Scaling the text. #+begin_src emacs-lisp (defhydra hydra-text-scale (:timeout 4) "Scale" ("j" text-scale-increase "Increase") ("k" text-scale-decrease "Decrease") ("f" nil "Finished" :exit t)) #+end_src + Scale the text inside of buffers with =SPC t f= * Increase =j= * Decrease =k= * Finished =f= #+begin_src emacs-lisp (dotfiles/leader "tf" '(hydra-text-scale/body :which-key "Font")) #+end_src ** Icon fonts Dired feels more modern with prioritized icon fonts using *All the Icons*[fn:3]. This makes navigation and visually parsing directories much faster, given that file types are quickly identified by their corresponding icons. #+begin_src emacs-lisp (use-package all-the-icons) #+end_src Integration with the *All the Icons Dired*[fn:4]package. #+begin_src emacs-lisp (use-package all-the-icons-dired :hook (dired-mode . all-the-icons-dired-mode)) #+end_src ** Symbols Programming buffers made prettier with *Pretty mode*[fn:9], complimentary to the built-in *Prettify symbols mode*[fn:10]. #+begin_src emacs-lisp (use-package pretty-mode :hook (python-mode . turn-on-pretty-mode)) #+end_src ** Ligatures Enable font ligatures via *Fira Code mode*[fn:11]. + Perform when *Fira Code* is the current font + Don't enable on TTY #+begin_src emacs-lisp (use-package fira-code-mode :when (and (window-system) (equal dotfiles/font "Fira Code")) :hook (prog-mode org-mode)) #+end_src Toggle global ligature mode with =SPC t g=. #+begin_src emacs-lisp (dotfiles/leader "tg" '(global-fira-code-mode :which-key "Ligatures")) #+end_src ** Emojification Gotta have those emojis, first class support for Emacs via the *Emacs-emojify*[fn:13] package. #+begin_src emacs-lisp (use-package emojify :when (window-system) :hook (after-init . global-emojify-mode)) #+end_src + Place *Emojify*[fn:13] bindings behind =SPC f= * List with =l= * Search with =s= * Insert with =i= * Describe with =d= #+begin_src emacs-lisp (dotfiles/leader "f" '(:ignore t :which-key "Emojify") "fl" '(emojify-list-emojis :which-key "List") "fs" '(emojify-apropos-emoji :which-key "Search") "fi" '(emojify-insert-emoji :which-key "Insert") "fd" '(emojify-describe-emoji :which-key "Describe")) #+end_src * Modern themes #+ATTR_ORG: :width 420px #+ATTR_HTML: :width 420px #+ATTR_LATEX: :width 420px [[../docs/images/what-is-emacs-customizable.gif]] High quality and modern colour themes are provided in the *Doom Themes*[fn:5] package. #+begin_src emacs-lisp (use-package doom-themes :init (load-theme 'doom-moonlight t)) #+end_src Load a theme with =SPC t t=. #+begin_src emacs-lisp (dotfiles/leader "tt" '(counsel-load-theme t t :which-key "Theme")) #+end_src ** Status bar *Doom modeline*[fn:6] provides an elegant and modern status bar / modeline. #+begin_src emacs-lisp (use-package doom-modeline :custom (doom-modeline-height 16) :config (doom-modeline-mode 1)) #+end_src ** Line numbering Relative line numbers are important when using VI emulation keys. You can prefix commands with a number, allowing you to perform that action that number of times. Useful when navigating around pages that are hundreds, or even thousands of lines long. #+begin_example 5: 4: 3: 2: 1: 156: << CURRENT LINE >> 1: 2: 3: 4: 5: #+end_example #+begin_src emacs-lisp (use-package linum-relative :custom (linum-delay t) (linum-relative-backend 'display-line-numbers-mode) :config (linum-relative-global-mode)) #+end_src Toggle line numbers with =SPC t l=. #+begin_src emacs-lisp (dotfiles/leader "tl" '(linum-relative-global-mode :which-key "Lines")) #+end_src ** Parenthesis Colourize nested parenthesis with *Rainbow delimeters*[fn:8]. #+begin_src emacs-lisp (use-package rainbow-delimiters :hook (prog-mode . rainbow-delimiters-mode)) #+end_src ** Superstar Make headline stars *super* with *Org superstar mode*[fn:14]. #+begin_src emacs-lisp (use-package org-superstar :when (window-system) :after org :hook (org-mode . org-superstar-mode)) #+end_src * Resources [fn:1] https://github.com/abo-abo/swiper [fn:2] https://github.com/Yevgnen/ivy-rich [fn:3] [[https://github.com/domtronn/all-the-icons.el]] [fn:4] https://github.com/jtbm37/all-the-icons-dired [fn:5] https://github.com/hlissner/emacs-doom-themes [fn:6] https://github.com/seagle0128/doom-modeline [fn:7] https://github.com/emacsmirror/linum-relative [fn:8] https://github.com/Fanael/rainbow-delimiters [fn:9] https://emacswiki.org/emacs/pretty-mode.el [fn:10] https://emacswiki.org/emacs/PrettySymbol [fn:11] https://github.com/jming422/fira-code-mode [fn:12] https://github.com/emacs-dashboard/emacs-dashboard [fn:13] https://github.com/iqbalansari/emacs-emojify [fn:14] https://github.com/integral-dw/org-superstar-mode