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.

123 lines
4.0 KiB

4 years ago
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. ** Scrolling
  40. Emacs' default scrolling behaviour is annoying. The sudden half-page jumps and the variable scroll-speed can be fixed with a few simple commands.
  41. #+begin_src emacs-lisp
  42. (setq scroll-conservatively 101 ;; Values >= 100 fix page jumping.
  43. mouse-wheel-scroll-amount '(3 ((shift) . 3)) ;; Control the number of lines per jump.
  44. mouse-wheel-progressive-speed t ;; Accelerate scrolling with the mouse wheel.
  45. mouse-wheel-follow-mouse t) ;; Scroll the window under the mouse.
  46. #+end_src
  47. ** Ligatures
  48. 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.
  49. #+begin_src emacs-lisp
  50. (use-package fira-code-mode
  51. :when (and (window-system)
  52. (equal dotfiles/font "Fira Code"))
  53. :hook (prog-mode org-mode))
  54. #+end_src
  55. ** Parenthesis
  56. Colourize nested parenthesis with ~rainbow-delimeters~[fn:4], a mandatory life-jacked to keep you from drowning in the sea of them in Lisp.
  57. #+begin_src emacs-lisp
  58. (use-package rainbow-delimiters
  59. :hook (prog-mode . rainbow-delimiters-mode))
  60. #+end_src
  61. ** Text scaling
  62. 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.
  63. #+begin_src emacs-lisp
  64. (defhydra hydra-text-scale (:timeout 4)
  65. "Scale"
  66. ("j" text-scale-increase "Increase")
  67. ("k" text-scale-decrease "Decrease")
  68. ("f" nil "Finished" :exit t))
  69. #+end_src
  70. * Shortcuts
  71. Scale the text inside of buffers using the custom transient binding, behind =SPC t f=:
  72. + Increase with =j=
  73. + Decrease with =k=
  74. + Finish with =f=
  75. #+begin_src emacs-lisp
  76. (dotfiles/leader
  77. "tf" '(hydra-text-scale/body :which-key "Font"))
  78. #+end_src
  79. * Footnotes
  80. [fn:1] https://github.com/tonsky/FiraCode
  81. [fn:2] [[https://github.com/domtronn/all-the-icons.el]]
  82. [fn:3] https://github.com/jtbm37/all-the-icons-dired
  83. [fn:4] https://github.com/Fanael/rainbow-delimiters
  84. [fn:5] https://github.com/jming422/fira-code-mode