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.

277 lines
7.1 KiB

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. * Unified fonts
  56. Write out to all of Emacs' available font faces with the unified font defined in the options.
  57. #+begin_src emacs-lisp
  58. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  59. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  60. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  61. #+end_src
  62. ** Text scaling
  63. Define a transient keybinding for Scaling the text.
  64. #+begin_src emacs-lisp
  65. (defhydra hydra-text-scale (:timeout 4)
  66. "Scale"
  67. ("j" text-scale-increase "Increase")
  68. ("k" text-scale-decrease "Decrease")
  69. ("f" nil "Finished" :exit t))
  70. #+end_src
  71. + Scale the text inside of buffers with =SPC t f=
  72. * Increase =j=
  73. * Decrease =k=
  74. * Finished =f=
  75. #+begin_src emacs-lisp
  76. (dotfiles/leader
  77. "tf" '(hydra-text-scale/body :which-key "Font"))
  78. #+end_src
  79. ** Icon fonts
  80. 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.
  81. #+begin_src emacs-lisp
  82. (use-package all-the-icons)
  83. #+end_src
  84. Integration with the *All the Icons Dired*[fn:4]package.
  85. #+begin_src emacs-lisp
  86. (use-package all-the-icons-dired
  87. :hook (dired-mode . all-the-icons-dired-mode))
  88. #+end_src
  89. ** Symbols
  90. Programming buffers made prettier with *Pretty mode*[fn:9], complimentary to the built-in *Prettify symbols mode*[fn:10].
  91. #+begin_src emacs-lisp
  92. (use-package pretty-mode
  93. :hook (python-mode . turn-on-pretty-mode))
  94. #+end_src
  95. ** Ligatures
  96. Enable font ligatures via *Fira Code mode*[fn:11].
  97. + Perform when *Fira Code* is the current font
  98. + Don't enable on TTY
  99. #+begin_src emacs-lisp
  100. (use-package fira-code-mode
  101. :when (and (window-system)
  102. (equal dotfiles/font "Fira Code"))
  103. :hook (prog-mode org-mode))
  104. #+end_src
  105. Toggle global ligature mode with =SPC t g=.
  106. #+begin_src emacs-lisp
  107. (dotfiles/leader
  108. "tg" '(global-fira-code-mode :which-key "Ligatures"))
  109. #+end_src
  110. ** Emojification
  111. Gotta have those emojis, first class support for Emacs via the *Emacs-emojify*[fn:13] package.
  112. #+begin_src emacs-lisp
  113. (use-package emojify
  114. :when (window-system)
  115. :hook (after-init . global-emojify-mode))
  116. #+end_src
  117. + Place *Emojify*[fn:13] bindings behind =SPC f=
  118. * List with =l=
  119. * Search with =s=
  120. * Insert with =i=
  121. * Describe with =d=
  122. #+begin_src emacs-lisp
  123. (dotfiles/leader
  124. "f" '(:ignore t :which-key "Emojify")
  125. "fl" '(emojify-list-emojis :which-key "List")
  126. "fs" '(emojify-apropos-emoji :which-key "Search")
  127. "fi" '(emojify-insert-emoji :which-key "Insert")
  128. "fd" '(emojify-describe-emoji :which-key "Describe"))
  129. #+end_src
  130. * Modern themes
  131. #+ATTR_ORG: :width 420px
  132. #+ATTR_HTML: :width 420px
  133. #+ATTR_LATEX: :width 420px
  134. [[../docs/images/what-is-emacs-customizable.gif]]
  135. High quality and modern colour themes are provided in the *Doom Themes*[fn:5] package.
  136. #+begin_src emacs-lisp
  137. (use-package doom-themes
  138. :init (load-theme 'doom-moonlight t))
  139. #+end_src
  140. Load a theme with =SPC t t=.
  141. #+begin_src emacs-lisp
  142. (dotfiles/leader
  143. "tt" '(counsel-load-theme t t :which-key "Theme"))
  144. #+end_src
  145. ** Status bar
  146. *Doom modeline*[fn:6] provides an elegant and modern status bar / modeline.
  147. #+begin_src emacs-lisp
  148. (use-package doom-modeline
  149. :custom (doom-modeline-height 16)
  150. :config (doom-modeline-mode 1))
  151. #+end_src
  152. ** Line numbering
  153. 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.
  154. #+begin_example
  155. 5:
  156. 4:
  157. 3:
  158. 2:
  159. 1:
  160. 156: << CURRENT LINE >>
  161. 1:
  162. 2:
  163. 3:
  164. 4:
  165. 5:
  166. #+end_example
  167. #+begin_src emacs-lisp
  168. (use-package linum-relative
  169. :custom (linum-delay t)
  170. (linum-relative-backend 'display-line-numbers-mode)
  171. :config (linum-relative-global-mode))
  172. #+end_src
  173. Toggle line numbers with =SPC t l=.
  174. #+begin_src emacs-lisp
  175. (dotfiles/leader
  176. "tl" '(linum-relative-global-mode :which-key "Lines"))
  177. #+end_src
  178. ** Parenthesis
  179. Colourize nested parenthesis with *Rainbow delimeters*[fn:8].
  180. #+begin_src emacs-lisp
  181. (use-package rainbow-delimiters
  182. :hook (prog-mode . rainbow-delimiters-mode))
  183. #+end_src
  184. ** Superstar
  185. Make headline stars *super* with *Org superstar mode*[fn:14].
  186. #+begin_src emacs-lisp
  187. (use-package org-superstar
  188. :when (window-system)
  189. :after org
  190. :hook (org-mode . org-superstar-mode))
  191. #+end_src
  192. * Resources
  193. [fn:1] https://github.com/abo-abo/swiper
  194. [fn:2] https://github.com/Yevgnen/ivy-rich
  195. [fn:3] [[https://github.com/domtronn/all-the-icons.el]]
  196. [fn:4] https://github.com/jtbm37/all-the-icons-dired
  197. [fn:5] https://github.com/hlissner/emacs-doom-themes
  198. [fn:6] https://github.com/seagle0128/doom-modeline
  199. [fn:7] https://github.com/emacsmirror/linum-relative
  200. [fn:8] https://github.com/Fanael/rainbow-delimiters
  201. [fn:9] https://emacswiki.org/emacs/pretty-mode.el
  202. [fn:10] https://emacswiki.org/emacs/PrettySymbol
  203. [fn:11] https://github.com/jming422/fira-code-mode
  204. [fn:12] https://github.com/emacs-dashboard/emacs-dashboard
  205. [fn:13] https://github.com/iqbalansari/emacs-emojify
  206. [fn:14] https://github.com/integral-dw/org-superstar-mode