I showed you my source code, pls respond
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

113 lines
3.5 KiB

4 years ago
4 years ago
  1. #+TITLE: Fonts
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle fonts.el :comments org
  5. #+PROPERTY: header-args:shell :tangle no
  6. #+PROPERTY: header-args :results silent :eval no-export :comments org
  7. #+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil
  8. #+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp:nil
  9. Unified system font across Emacs.
  10. * Setup
  11. Install the required ~firacode~[fn:1] font before loading the module:
  12. #+begin_src shell
  13. RUN apt install -y fonts-firacode
  14. #+end_src
  15. * Config
  16. Write out the value of ~dotfiles/font~ to all of the available font faces supported by Emacs. By default, this uses ~firacode~[fn:1] for its readability and ligature support. All of the heights are configured to ~dotfiles/font-size~ by default, with further configuration based on the given size possible.
  17. #+begin_src emacs-lisp
  18. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  19. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  20. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  21. #+end_src
  22. ** Icons
  23. Emacs feels more modern with prioritized icon fonts, available in the ~all-the-icons~[fn:2] package. This makes navigation and visually parsing directories much faster, given that the file types are quickly identified by their corresponding icons.
  24. #+begin_src emacs-lisp
  25. (use-package all-the-icons)
  26. #+end_src
  27. Integration with the built-in ~dired~ package is available in the ~all-the-icons-dired~[fn:3] package.
  28. #+begin_src emacs-lisp
  29. (use-package all-the-icons-dired
  30. :hook (dired-mode . all-the-icons-dired-mode))
  31. #+end_src
  32. ** Emojis
  33. It's finally here, first class support for Emojis in Emacs via the ~emacs-emojify~[fn:4] package. Have we finally gone too far?
  34. #+begin_src emacs-lisp
  35. (use-package emojify
  36. :when (window-system)
  37. :hook (after-init . global-emojify-mode))
  38. #+end_src
  39. ** Ligatures
  40. Enable ~firacode~[fn:1] font ligatures with the ~fira-code-mode~[fn:5] package. Only perform this action when ~firacode~[fn:1] is the current font, and Emacs isn't running on the TTY.
  41. #+begin_src emacs-lisp
  42. (use-package fira-code-mode
  43. :when (and (window-system)
  44. (equal dotfiles/font "Fira Code"))
  45. :hook (prog-mode org-mode))
  46. #+end_src
  47. ** Parenthesis
  48. Colourize nested parenthesis with ~rainbow-delimeters~[fn:4], a mandatory life-jacked to keep you from drowning in the sea of them in Lisp.
  49. #+begin_src emacs-lisp
  50. (use-package rainbow-delimiters
  51. :hook (prog-mode . rainbow-delimiters-mode))
  52. #+end_src
  53. ** Text scaling
  54. Define a transient keybinding for scaling the text. One caveat to this, it only works when Emacs is running as a GUI application, and has no effect in the terminal.
  55. #+begin_src emacs-lisp
  56. (defhydra hydra-text-scale (:timeout 4)
  57. "Scale"
  58. ("j" text-scale-increase "Increase")
  59. ("k" text-scale-decrease "Decrease")
  60. ("f" nil "Finished" :exit t))
  61. #+end_src
  62. * Shortcuts
  63. Scale the text inside of buffers using the custom transient binding, behind =SPC t f=:
  64. + Increase with =j=
  65. + Decrease with =k=
  66. + Finish with =f=
  67. #+begin_src emacs-lisp
  68. (dotfiles/leader
  69. "tf" '(hydra-text-scale/body :which-key "Font"))
  70. #+end_src
  71. * Footnotes
  72. [fn:1] https://github.com/tonsky/FiraCode
  73. [fn:2] [[https://github.com/domtronn/all-the-icons.el]]
  74. [fn:3] https://github.com/jtbm37/all-the-icons-dired
  75. [fn:4] https://github.com/Fanael/rainbow-delimiters
  76. [fn:5] https://github.com/jming422/fira-code-mode