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.

301 lines
7.6 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
  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. * Line numbering
  163. 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.
  164. #+begin_example
  165. 5:
  166. 4:
  167. 3:
  168. 2:
  169. 1:
  170. 156: << CURRENT LINE >>
  171. 1:
  172. 2:
  173. 3:
  174. 4:
  175. 5:
  176. #+end_example
  177. #+begin_src emacs-lisp
  178. (use-package linum-relative
  179. :commands (linum-relative-global-mode)
  180. :custom (linum-delay t)
  181. (linum-relative-backend 'display-line-numbers-mode))
  182. #+end_src
  183. Toggle line numbers with =SPC t l=.
  184. #+begin_src emacs-lisp
  185. (dotfiles/leader
  186. "tl" '(linum-relative-global-mode :which-key "Lines"))
  187. #+end_src
  188. * Parenthesis
  189. Colourize nested parenthesis with *Rainbow delimeters*[fn:11].
  190. #+begin_src emacs-lisp
  191. (use-package rainbow-delimiters
  192. :hook (prog-mode . rainbow-delimiters-mode))
  193. #+end_src
  194. * Superstar
  195. Make headline stars *super* with *Org superstar mode*[fn:12].
  196. #+begin_src emacs-lisp
  197. (use-package org-superstar
  198. :when (window-system)
  199. :after org
  200. :hook (org-mode . org-superstar-mode))
  201. #+end_src
  202. * Footnotes
  203. [fn:1] https://github.com/abo-abo/swiper
  204. [fn:2] https://github.com/Yevgnen/ivy-rich
  205. [fn:3] [[https://github.com/domtronn/all-the-icons.el]]
  206. [fn:4] https://github.com/jtbm37/all-the-icons-dired
  207. [fn:5] https://emacswiki.org/emacs/pretty-mode.el
  208. [fn:6] https://emacswiki.org/emacs/PrettySymbol
  209. [fn:7] https://github.com/jming422/fira-code-mode
  210. [fn:8] https://github.com/iqbalansari/emacs-emojify
  211. [fn:9] https://github.com/hlissner/emacs-doom-themes
  212. [fn:10] https://github.com/seagle0128/doom-modeline
  213. [fn:11] https://github.com/Fanael/rainbow-delimiters
  214. [fn:12] https://github.com/integral-dw/org-superstar-mode
  215. [fn:13] https://github.com/emacs-dashboard/emacs-dashboard
  216. [fn:14] https://github.com/emacsmirror/linum-relative