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.

267 lines
7.8 KiB

  1. #+TITLE: Interface
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+PROPERTY: header-args:emacs-lisp :tangle interface.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. #+ATTR_ORG: :width 420px
  10. #+ATTR_HTML: :width 420px
  11. #+ATTR_LATEX: :width 420px
  12. [[../docs/images/what-is-emacs-teaser.png]]
  13. *Bring Emacs out of the eighties*
  14. * Completion
  15. 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.
  16. ** Selection menu
  17. *Ivy*[fn:1] is a powerful selection menu for Emacs.
  18. #+begin_src emacs-lisp
  19. (use-package ivy
  20. :diminish
  21. :config (ivy-mode 1))
  22. #+end_src
  23. ** Replace built in commands
  24. *Counsel*[fn:1] is a customized set of commands to replace built in completion buffers.
  25. #+begin_src emacs-lisp
  26. (use-package counsel
  27. :after ivy
  28. :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
  29. :config (counsel-mode 1))
  30. #+end_src
  31. *** Switch buffers with ,
  32. Cherry picked from =doom=.
  33. #+begin_src emacs-lisp
  34. (dotfiles/leader
  35. "," '(counsel-switch-buffer :which-key "Buffers"))
  36. #+end_src
  37. ** Additional details
  38. Provide more information about each item in the completion menu with *Ivy rich*[fn:2].
  39. #+begin_src emacs-lisp
  40. (use-package ivy-rich
  41. :after counsel
  42. :init (ivy-rich-mode 1))
  43. #+end_src
  44. * Fonts
  45. Write out to all of Emacs' available font faces with the unified font defined in the options.
  46. #+begin_src emacs-lisp
  47. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  48. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  49. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  50. #+end_src
  51. ** Text scaling
  52. Define a transient keybinding for Scaling the text.
  53. #+begin_src emacs-lisp
  54. (defhydra hydra-text-scale (:timeout 4)
  55. "Scale"
  56. ("j" text-scale-increase "Increase")
  57. ("k" text-scale-decrease "Decrease")
  58. ("f" nil "Finished" :exit t))
  59. #+end_src
  60. + Scale the text inside of buffers with =SPC t f=
  61. * Increase =j=
  62. * Decrease =k=
  63. * Finished =f=
  64. #+begin_src emacs-lisp
  65. (dotfiles/leader
  66. "tf" '(hydra-text-scale/body :which-key "Font"))
  67. #+end_src
  68. * Icons
  69. 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.
  70. #+begin_src emacs-lisp
  71. (use-package all-the-icons)
  72. #+end_src
  73. Integration with the *All the Icons Dired*[fn:4]package.
  74. #+begin_src emacs-lisp
  75. (use-package all-the-icons-dired
  76. :hook (dired-mode . all-the-icons-dired-mode))
  77. #+end_src
  78. * Themes
  79. #+ATTR_ORG: :width 420px
  80. #+ATTR_HTML: :width 420px
  81. #+ATTR_LATEX: :width 420px
  82. [[../docs/images/what-is-emacs-customizable.gif]]
  83. High quality and modern colour themes are provided in the *Doom Themes*[fn:5] package.
  84. #+begin_src emacs-lisp
  85. (use-package doom-themes
  86. :init (load-theme 'doom-moonlight t))
  87. #+end_src
  88. Load a theme with =SPC t t=.
  89. #+begin_src emacs-lisp
  90. (dotfiles/leader
  91. "tt" '(counsel-load-theme t t :which-key "Theme"))
  92. #+end_src
  93. * Modeline
  94. *Doom modeline*[fn:6] provides an elegant and modern status bar / modeline.
  95. #+begin_src emacs-lisp
  96. (use-package doom-modeline
  97. :custom (doom-modeline-height 16)
  98. :config (doom-modeline-mode 1))
  99. #+end_src
  100. * Line numbering
  101. 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.
  102. #+begin_example
  103. 5:
  104. 4:
  105. 3:
  106. 2:
  107. 1:
  108. 156: << CURRENT LINE >>
  109. 1:
  110. 2:
  111. 3:
  112. 4:
  113. 5:
  114. #+end_example
  115. #+begin_src emacs-lisp
  116. (use-package linum-relative
  117. :commands (linum-relative-global-mode)
  118. :custom (linum-relative-backend 'display-line-numbers-mode))
  119. #+end_src
  120. Toggle line numbers with =SPC t l=.
  121. #+begin_src emacs-lisp
  122. (dotfiles/leader
  123. "tl" '(linum-relative-global-mode :which-key "Lines"))
  124. #+end_src
  125. * Parenthesis
  126. Colourize nested parenthesis with *Rainbow delimeters*[fn:8].
  127. #+begin_src emacs-lisp
  128. (use-package rainbow-delimiters
  129. :hook (prog-mode . rainbow-delimiters-mode))
  130. #+end_src
  131. * Pretty symbols
  132. Programming buffers made prettier with *Pretty mode*[fn:9], complimentary to the built-in *Prettify symbols mode*[fn:10].
  133. #+begin_src emacs-lisp
  134. (use-package pretty-mode
  135. :hook (python-mode . turn-on-pretty-mode))
  136. #+end_src
  137. * Ligatures
  138. Enable font ligatures via *Fira Code mode*[fn:11], perform this action *only* when *Fira Code* is the current font.
  139. #+begin_src emacs-lisp
  140. (when (display-graphic-p)
  141. (use-package fira-code-mode
  142. :hook (prog-mode org-mode)))
  143. #+end_src
  144. Toggle global ligature mode with =SPC t g=.
  145. #+begin_src emacs-lisp
  146. (dotfiles/leader
  147. "tg" '(global-fira-code-mode :which-key "Ligatures"))
  148. #+end_src
  149. * Dashboard
  150. #+ATTR_ORG: :width 420px
  151. #+ATTR_HTML: :width 420px
  152. #+ATTR_LATEX: :width 420px
  153. [[../docs/images/desktop.png]]
  154. Present a *Dashboard* when first launching Emacs. Customize the buttons of the navigator.
  155. + Brain @ http://localhost:8080
  156. + Homepage @ https://chrishayward.xyz
  157. + Athabasca @ https://login.athabascau.ca/cas/login
  158. + Bookshelf @ https://online.vitalsource.com
  159. #+begin_src emacs-lisp
  160. (use-package dashboard
  161. :custom (dashboard-center-content t)
  162. (dashboard-set-init-info t)
  163. (dashboard-set-file-icons t)
  164. (dashboard-set-heading-icons t)
  165. (dashboard-set-navigator t)
  166. (dashboard-startup-banner 'logo)
  167. (dashboard-projects-backend 'projectile)
  168. (dashboard-items '((projects . 5) (recents . 5) (agenda . 10)))
  169. (dashboard-navigator-buttons `(((,(all-the-icons-fileicon "brain" :height 1.1 :v-adjust 0.0)
  170. "Brain" "Knowledge base"
  171. (lambda (&rest _) (browse-url "http://localhost:8080"))))
  172. ((,(all-the-icons-material "public" :height 1.1 :v-adjust 0.0)
  173. "Homepage" "Personal website"
  174. (lambda (&rest _) (browse-url "https://chrishayward.xyz"))))
  175. ((,(all-the-icons-faicon "university" :height 1.1 :v-adjust 0.0)
  176. "Athabasca" "Univeristy login"
  177. (lambda (&rest _) (browse-url "https://login.athabascau.ca/cas/login"))))
  178. ((,(all-the-icons-faicon "book" :height 1.1 :v-adjust 0.0)
  179. "Bookshelf" "Vitalsource bookshelf"
  180. (lambda (&rest _) (browse-url "https://online.vitalsource.com"))))))
  181. :config (dashboard-setup-startup-hook))
  182. #+end_src
  183. When running in *daemon* mode, ensure that the dashboard is the initial buffer.
  184. #+begin_src emacs-lisp
  185. (setq initial-buffer-choice
  186. (lambda ()
  187. (get-buffer "*dashboard*")))
  188. #+end_src
  189. * Resources
  190. [fn:1] https://github.com/abo-abo/swiper
  191. [fn:2] https://github.com/Yevgnen/ivy-rich
  192. [fn:3] [[https://github.com/domtronn/all-the-icons.el]]
  193. [fn:4] https://github.com/jtbm37/all-the-icons-dired
  194. [fn:5] https://github.com/hlissner/emacs-doom-themes
  195. [fn:6] https://github.com/seagle0128/doom-modeline
  196. [fn:7] https://github.com/emacsmirror/linum-relative
  197. [fn:8] https://github.com/Fanael/rainbow-delimiters
  198. [fn:9] https://emacswiki.org/emacs/pretty-mode.el
  199. [fn:10] https://emacswiki.org/emacs/PrettySymbol
  200. [fn:11] https://github.com/jming422/fira-code-mode
  201. [fn:12] https://github.com/emacs-dashboard/emacs-dashboard