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.

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