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.

311 lines
8.9 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. * Superstar
  132. Make headline stars *super* with *Org superstar mode*[fn:14].
  133. #+begin_src emacs-lisp
  134. (use-package org-superstar
  135. :after org
  136. :hook (org-mode . org-superstar-mode))
  137. #+end_src
  138. * Emojis
  139. Gotta have those emojis, first class support for Emacs via the *Emacs-emojify*[fn:13] package.
  140. #+begin_src emacs-lisp
  141. (use-package emojify
  142. :hook (after-init . global-emojify-mode))
  143. #+end_src
  144. + Place *Emojify*[fn:13] bindings behind =SPC f=
  145. * List with =l=
  146. * Search with =s=
  147. * Insert with =i=
  148. * Describe with =d=
  149. #+begin_src emacs-lisp
  150. (dotfiles/leader
  151. "f" '(:ignore t :which-key "Emojify")
  152. "fl" '(emojify-list-emojis :which-key "List")
  153. "fs" '(emojify-apropos-emoji :which-key "Search")
  154. "fi" '(emojify-insert-emoji :which-key "Insert")
  155. "fd" '(emojify-describe-emoji :which-key "Describe"))
  156. #+end_src
  157. * Symbols
  158. Programming buffers made prettier with *Pretty mode*[fn:9], complimentary to the built-in *Prettify symbols mode*[fn:10].
  159. #+begin_src emacs-lisp
  160. (use-package pretty-mode
  161. :hook (python-mode . turn-on-pretty-mode))
  162. #+end_src
  163. * Ligatures
  164. Enable font ligatures via *Fira Code mode*[fn:11], perform this action *only* when *Fira Code* is the current font.
  165. #+begin_src emacs-lisp
  166. (when (display-graphic-p)
  167. (use-package fira-code-mode
  168. :hook (prog-mode org-mode)))
  169. #+end_src
  170. Toggle global ligature mode with =SPC t g=.
  171. #+begin_src emacs-lisp
  172. (dotfiles/leader
  173. "tg" '(global-fira-code-mode :which-key "Ligatures"))
  174. #+end_src
  175. * Dashboard
  176. #+ATTR_ORG: :width 420px
  177. #+ATTR_HTML: :width 420px
  178. #+ATTR_LATEX: :width 420px
  179. [[../docs/images/desktop.png]]
  180. Present a *Dashboard* when first launching Emacs. Customize the buttons of the navigator.
  181. + Brain @ http://localhost:8080
  182. + Homepage @ https://chrishayward.xyz
  183. + Athabasca @ https://login.athabascau.ca/cas/login
  184. + Bookshelf @ https://online.vitalsource.com
  185. #+begin_src emacs-lisp
  186. (use-package dashboard
  187. :custom (dashboard-center-content t)
  188. (dashboard-set-init-info t)
  189. (dashboard-set-file-icons t)
  190. (dashboard-set-heading-icons t)
  191. (dashboard-set-navigator t)
  192. (dashboard-startup-banner 'logo)
  193. (dashboard-projects-backend 'projectile)
  194. (dashboard-items '((projects . 10) (recents . 10) (agenda . 10)))
  195. (dashboard-navigator-buttons `(((,(all-the-icons-fileicon "brain" :height 1.1 :v-adjust 0.0)
  196. "Brain" "Knowledge base"
  197. (lambda (&rest _) (browse-url "http://localhost:8080"))))
  198. ((,(all-the-icons-material "public" :height 1.1 :v-adjust 0.0)
  199. "Homepage" "Personal website"
  200. (lambda (&rest _) (browse-url "https://chrishayward.xyz"))))
  201. ((,(all-the-icons-faicon "university" :height 1.1 :v-adjust 0.0)
  202. "Athabasca" "Univeristy login"
  203. (lambda (&rest _) (browse-url "https://login.athabascau.ca/cas/login"))))
  204. ((,(all-the-icons-faicon "book" :height 1.1 :v-adjust 0.0)
  205. "Bookshelf" "Vitalsource bookshelf"
  206. (lambda (&rest _) (browse-url "https://online.vitalsource.com"))))))
  207. :config (dashboard-setup-startup-hook))
  208. #+end_src
  209. When running in *daemon* mode, ensure that the dashboard is the initial buffer.
  210. #+begin_src emacs-lisp
  211. (setq initial-buffer-choice
  212. (lambda ()
  213. (get-buffer "*dashboard*")))
  214. #+end_src
  215. Quickly navigate to the dashboard with =SPC SPC=.
  216. #+begin_src emacs-lisp
  217. (dotfiles/leader
  218. "SPC" '((lambda () (interactive) (switch-to-buffer "*dashboard*")) :which-key "Dashboard"))
  219. #+end_src
  220. * Resources
  221. [fn:1] https://github.com/abo-abo/swiper
  222. [fn:2] https://github.com/Yevgnen/ivy-rich
  223. [fn:3] [[https://github.com/domtronn/all-the-icons.el]]
  224. [fn:4] https://github.com/jtbm37/all-the-icons-dired
  225. [fn:5] https://github.com/hlissner/emacs-doom-themes
  226. [fn:6] https://github.com/seagle0128/doom-modeline
  227. [fn:7] https://github.com/emacsmirror/linum-relative
  228. [fn:8] https://github.com/Fanael/rainbow-delimiters
  229. [fn:9] https://emacswiki.org/emacs/pretty-mode.el
  230. [fn:10] https://emacswiki.org/emacs/PrettySymbol
  231. [fn:11] https://github.com/jming422/fira-code-mode
  232. [fn:12] https://github.com/emacs-dashboard/emacs-dashboard
  233. [fn:13] https://github.com/iqbalansari/emacs-emojify
  234. [fn:14] https://github.com/integral-dw/org-superstar-mode