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.

302 lines
7.5 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  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. * Menu 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. ** Popup selection frame
  24. + Display =ivy= completions in a popup buffer
  25. + Set ~parent-frame~ to =nil= for [[file:desktop.org][Desktop]] support
  26. #+begin_src emacs-lisp
  27. (use-package ivy-posframe
  28. :after ivy
  29. :when (window-system)
  30. :custom (ivy-posframe-display-functions-alist '((t . ivy-posframe-display)))
  31. (ivy-posframe-parameters '((parent-frame nil)))
  32. :config (ivy-posframe-mode 1))
  33. #+end_src
  34. ** Replace built in commands
  35. *Counsel*[fn:1] is a customized set of commands to replace built in completion buffers.
  36. #+begin_src emacs-lisp
  37. (use-package counsel
  38. :after ivy
  39. :custom (counsel-linux-app-format-function #'counsel-linux-app-format-function-name-only)
  40. :config (counsel-mode 1))
  41. #+end_src
  42. *** Switch buffers with ,
  43. Cherry picked from =doom=.
  44. #+begin_src emacs-lisp
  45. (dotfiles/leader
  46. "," '(counsel-switch-buffer :which-key "Buffers"))
  47. #+end_src
  48. ** Additional details
  49. Provide more information about each item in the completion menu with *Ivy rich*[fn:2].
  50. #+begin_src emacs-lisp
  51. (use-package ivy-rich
  52. :after counsel
  53. :init (ivy-rich-mode 1))
  54. #+end_src
  55. ** Candidate sorting
  56. Sort completion candidates based on how recently or frequently they're selected. This can be helpful when using =M-x= to run commands that aren't bound to specific key-strokes.
  57. #+begin_src emacs-lisp
  58. (use-package ivy-prescient
  59. :after counsel
  60. :custom (ivy-prescient-enable-filtering nil)
  61. :config (prescient-persist-mode 1)
  62. (ivy-prescient-mode 1))
  63. #+end_src
  64. * Unified fonts
  65. Write out to all of Emacs' available font faces with the unified font defined in the options.
  66. #+begin_src emacs-lisp
  67. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  68. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  69. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  70. #+end_src
  71. ** Text scaling
  72. Define a transient keybinding for Scaling the text.
  73. #+begin_src emacs-lisp
  74. (defhydra hydra-text-scale (:timeout 4)
  75. "Scale"
  76. ("j" text-scale-increase "Increase")
  77. ("k" text-scale-decrease "Decrease")
  78. ("f" nil "Finished" :exit t))
  79. #+end_src
  80. + Scale the text inside of buffers with =SPC t f=
  81. * Increase =j=
  82. * Decrease =k=
  83. * Finished =f=
  84. #+begin_src emacs-lisp
  85. (dotfiles/leader
  86. "tf" '(hydra-text-scale/body :which-key "Font"))
  87. #+end_src
  88. ** Icon fonts
  89. 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.
  90. #+begin_src emacs-lisp
  91. (use-package all-the-icons)
  92. #+end_src
  93. Integration with the *All the Icons Dired*[fn:4]package.
  94. #+begin_src emacs-lisp
  95. (use-package all-the-icons-dired
  96. :hook (dired-mode . all-the-icons-dired-mode))
  97. #+end_src
  98. ** Symbols
  99. Programming buffers made prettier with *Pretty mode*[fn:5], complimentary to the built-in *Prettify symbols mode*[fn:6].
  100. #+begin_src emacs-lisp
  101. (use-package pretty-mode
  102. :hook (python-mode . turn-on-pretty-mode))
  103. #+end_src
  104. ** Ligatures
  105. Enable font ligatures via *Fira Code mode*[fn:7].
  106. + Perform when *Fira Code* is the current font
  107. + Don't enable on TTY
  108. #+begin_src emacs-lisp
  109. (use-package fira-code-mode
  110. :when (and (window-system)
  111. (equal dotfiles/font "Fira Code"))
  112. :hook (prog-mode org-mode))
  113. #+end_src
  114. Toggle global ligature mode with =SPC t g=.
  115. #+begin_src emacs-lisp
  116. (dotfiles/leader
  117. "tg" '(global-fira-code-mode :which-key "Ligatures"))
  118. #+end_src
  119. ** Emojification
  120. Gotta have those emojis, first class support for Emacs via the *Emacs-emojify*[fn:8] package.
  121. #+begin_src emacs-lisp
  122. (use-package emojify
  123. :when (window-system)
  124. :hook (after-init . global-emojify-mode))
  125. #+end_src
  126. + Place *Emojify*[fn:8] bindings behind =SPC f=
  127. * List with =l=
  128. * Search with =s=
  129. * Insert with =i=
  130. * Describe with =d=
  131. #+begin_src emacs-lisp
  132. (dotfiles/leader
  133. "f" '(:ignore t :which-key "Emojify")
  134. "fl" '(emojify-list-emojis :which-key "List")
  135. "fs" '(emojify-apropos-emoji :which-key "Search")
  136. "fi" '(emojify-insert-emoji :which-key "Insert")
  137. "fd" '(emojify-describe-emoji :which-key "Describe"))
  138. #+end_src
  139. * Modern themes
  140. #+ATTR_ORG: :width 420px
  141. #+ATTR_HTML: :width 420px
  142. #+ATTR_LATEX: :width 420px
  143. [[../docs/images/what-is-emacs-customizable.gif]]
  144. High quality and modern colour themes are provided in the *Doom Themes*[fn:9] package.
  145. #+begin_src emacs-lisp
  146. (use-package doom-themes
  147. :init (load-theme 'doom-moonlight t))
  148. #+end_src
  149. Load a theme with =SPC t t=.
  150. #+begin_src emacs-lisp
  151. (dotfiles/leader
  152. "tt" '(counsel-load-theme t t :which-key "Theme"))
  153. #+end_src
  154. ** Status bar
  155. *Doom modeline*[fn:10] provides an elegant and modern status bar / modeline.
  156. #+begin_src emacs-lisp
  157. (use-package doom-modeline
  158. :custom (doom-modeline-height 16)
  159. :config (doom-modeline-mode 1))
  160. #+end_src
  161. ** Line numbering
  162. 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.
  163. #+begin_example
  164. 5:
  165. 4:
  166. 3:
  167. 2:
  168. 1:
  169. 156: << CURRENT LINE >>
  170. 1:
  171. 2:
  172. 3:
  173. 4:
  174. 5:
  175. #+end_example
  176. #+begin_src emacs-lisp
  177. (use-package linum-relative
  178. :commands (linum-relative-global-mode)
  179. :custom (linum-delay t)
  180. (linum-relative-backend 'display-line-numbers-mode))
  181. #+end_src
  182. Toggle line numbers with =SPC t l=.
  183. #+begin_src emacs-lisp
  184. (dotfiles/leader
  185. "tl" '(linum-relative-global-mode :which-key "Lines"))
  186. #+end_src
  187. ** Parenthesis
  188. Colourize nested parenthesis with *Rainbow delimeters*[fn:11].
  189. #+begin_src emacs-lisp
  190. (use-package rainbow-delimiters
  191. :hook (prog-mode . rainbow-delimiters-mode))
  192. #+end_src
  193. ** Superstar
  194. Make headline stars *super* with *Org superstar mode*[fn:12].
  195. #+begin_src emacs-lisp
  196. (use-package org-superstar
  197. :when (window-system)
  198. :after org
  199. :hook (org-mode . org-superstar-mode))
  200. #+end_src
  201. * Footnotes
  202. [fn:1] https://github.com/abo-abo/swiper
  203. [fn:2] https://github.com/Yevgnen/ivy-rich
  204. [fn:3] [[https://github.com/domtronn/all-the-icons.el]]
  205. [fn:4] https://github.com/jtbm37/all-the-icons-dired
  206. [fn:5] https://emacswiki.org/emacs/pretty-mode.el
  207. [fn:6] https://emacswiki.org/emacs/PrettySymbol
  208. [fn:7] https://github.com/jming422/fira-code-mode
  209. [fn:8] https://github.com/iqbalansari/emacs-emojify
  210. [fn:9] https://github.com/hlissner/emacs-doom-themes
  211. [fn:10] https://github.com/seagle0128/doom-modeline
  212. [fn:11] https://github.com/Fanael/rainbow-delimiters
  213. [fn:12] https://github.com/integral-dw/org-superstar-mode
  214. [fn:13] https://github.com/emacs-dashboard/emacs-dashboard
  215. [fn:14] https://github.com/emacsmirror/linum-relative