Lucien Cartier-Tilet
c7e996516b
Deactivate org tables in org-modern-mode Only show true filenames in modeline when opening files, better path in modeline
262 lines
9.8 KiB
Org Mode
262 lines
9.8 KiB
Org Mode
#+title: Emacs — Packages — Visual Configuration
|
||
#+setupfile: ../../headers
|
||
#+property: header-args:emacs-lisp :mkdirp yes :lexical t :exports code
|
||
#+property: header-args:emacs-lisp+ :tangle ~/.config/emacs/lisp/visual-config.el
|
||
#+property: header-args:emacs-lisp+ :mkdirp yes :noweb no-export
|
||
|
||
* Visual Configuration
|
||
** Dashboard
|
||
#+begin_src emacs-lisp
|
||
(use-package dashboard
|
||
:straight (:build t)
|
||
:ensure t
|
||
:after all-the-icons
|
||
:config
|
||
(setq dashboard-banner-logo-title "Phundrak’s Vanilla Emacs"
|
||
dashboard-startup-banner 'logo
|
||
dashboard-center-content t
|
||
dashboard-show-shortcuts t
|
||
dashboard-set-navigator t
|
||
dashboard-set-heading-icons t
|
||
dashboard-set-file-icons t
|
||
initial-buffer-choice (lambda () (get-buffer "*dashboard*"))
|
||
dashboard-projects-switch-function 'counsel-projectile-switch-project-by-name)
|
||
(setq dashboard-navigator-buttons
|
||
`(((,(all-the-icons-faicon "language" :height 1.1 :v-adjust 0.0)
|
||
"Linguistics Website"
|
||
""
|
||
(lambda (&rest _) (browse-url "https://langue.phundrak.com")))
|
||
|
||
(,(all-the-icons-faicon "firefox" :height 1.1 :v-adjust 0.0)
|
||
"Config Website"
|
||
""
|
||
(lambda (&rest _) (browse-url "https://config.phundrak.com"))))
|
||
|
||
((,(all-the-icons-octicon "git-branch" :height 1.1 :v-adjust 0.0)
|
||
"Dotfiles Sources"
|
||
""
|
||
(lambda (&rest _) (browse-url "https://labs.phundrak.com/phundrak/dotfiles")))
|
||
("!" "Issues" "Show issues" (lambda (&rest _)
|
||
(browse-url "https://labs.phundrak.com/phundrak/dotfiles/issues"))
|
||
warning))
|
||
((,(all-the-icons-faicon "level-up" :height 1.1 :v-adjust 0.0)
|
||
"Update Packages"
|
||
""
|
||
(lambda (&rest _) (progn
|
||
(require 'straight)
|
||
(straight-pull-all)
|
||
(straight-rebuild-all)))))))
|
||
|
||
(setq dashboard-items '((recents . 15)
|
||
(agenda . 10)
|
||
(projects . 10)))
|
||
(dashboard-setup-startup-hook)
|
||
:init
|
||
(add-hook 'after-init-hook 'dashboard-refresh-buffer))
|
||
#+end_src
|
||
|
||
** Fringe
|
||
It’s nice to know which lines were modified since the last commit in a
|
||
file.
|
||
#+begin_src emacs-lisp
|
||
(use-package git-gutter-fringe
|
||
:straight (:build t)
|
||
:hook ((prog-mode . git-gutter-mode)
|
||
(org-mode . git-gutter-mode)
|
||
(markdown-mode . git-gutter-mode)
|
||
(latex-mode . git-gutter-mode)))
|
||
#+end_src
|
||
|
||
** Icons? Did someone say icons?
|
||
/*YES! ALL OF THEM!*/
|
||
|
||
Ahem…
|
||
|
||
The package ~all-the-icons~ allows us to use a wide variety of icons in
|
||
Emacs for various purposes, wherever we want, and /THAT/ is *GREAT*! I’ll
|
||
(ab)use this feature in my config, be warned! *NOTE*: The first time a
|
||
configuration with ~all-the-icons~ loads on a machine, the needed fonts
|
||
might not be available, so you’ll need to install them with the
|
||
command ~M-x all-the-icons-install-fonts~.
|
||
#+begin_src emacs-lisp
|
||
(use-package all-the-icons
|
||
:defer t
|
||
:straight t)
|
||
#+end_src
|
||
~prettify-symbols-mode~ is also a nifty feature of Emacs, and it is
|
||
built-in! With that, I can replace strings of my choice by another
|
||
character of my choice! First, let’s declare the general symbols that
|
||
will be used everywhere.
|
||
#+begin_src emacs-lisp
|
||
(defun prog-mode-set-symbols-alist ()
|
||
(setq prettify-symbols-alist '(("lambda" . ?λ)))
|
||
(prettify-symbols-mode 1))
|
||
|
||
(add-hook 'prog-mode-hook #'prog-mode-set-symbols-alist)
|
||
#+end_src
|
||
|
||
We can now take care of the language-specific symbols. First, let’s
|
||
declare some symbols for the Lisp languages.
|
||
#+begin_src emacs-lisp
|
||
(setq-default lisp-prettify-symbols-alist '(("lambda" . ?λ)
|
||
("defun" . ?𝑓)
|
||
("defvar" . ?𝑣)
|
||
("defcustom" . ?𝑐)
|
||
("defconst" . ?𝐶)))
|
||
|
||
(defun lisp-mode-prettify ()
|
||
(setq prettify-symbols-alist lisp-prettify-symbols-alist)
|
||
(prettify-symbols-mode -1)
|
||
(prettify-symbols-mode 1))
|
||
|
||
(dolist (lang '(emacs-lisp lisp common-lisp scheme))
|
||
(add-hook (intern (format "%S-mode-hook" lang))
|
||
#'lisp-mode-prettify))
|
||
#+end_src
|
||
|
||
Finally, similar to how ~org-appear~ behaves, let’s show the real string
|
||
of our symbols when the cursor is on it.
|
||
#+begin_src emacs-lisp
|
||
(setq prettify-symbols-unprettify-at-point t)
|
||
#+end_src
|
||
|
||
** Ligatures
|
||
The font I’m using supports ligatures, but Emacs in GUI mode does not.
|
||
And of course, there’s a package for that.
|
||
|
||
#+begin_src emacs-lisp
|
||
(use-package ligature
|
||
:straight (ligature :type git
|
||
:host github
|
||
:repo "mickeynp/ligature.el"
|
||
:build t)
|
||
:config
|
||
(ligature-set-ligatures 't
|
||
'("www"))
|
||
;; Enable traditional ligature support in eww-mode, if the
|
||
;; `variable-pitch' face supports it
|
||
(ligature-set-ligatures '(eww-mode org-mode elfeed-show-mode)
|
||
'("ff" "fi" "ffi"))
|
||
;; Enable all Cascadia Code ligatures in programming modes
|
||
(ligature-set-ligatures 'prog-mode
|
||
'("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
|
||
":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
|
||
"!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
|
||
"<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
|
||
"<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
|
||
"..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
|
||
"~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
|
||
"[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
|
||
">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
|
||
"<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
|
||
"##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
|
||
"?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
|
||
"\\\\" "://"))
|
||
(global-ligature-mode t))
|
||
#+end_src
|
||
|
||
** Modeline
|
||
The DoomEmacs modeline looks nice in my opinion, let’s use it.
|
||
#+begin_src emacs-lisp
|
||
(use-package doom-modeline
|
||
:straight (:build t)
|
||
:defer t
|
||
:init
|
||
(doom-modeline-mode 1)
|
||
(setq find-file-visit-truename t)
|
||
:custom
|
||
(doom-modeline-height 15)
|
||
(doom-modeline-enable-word-count t)
|
||
(doom-modeline-continuous-word-count-modes '(markdown-mode gfm-mode org-mode))
|
||
(doom-modeline-mu4e t)
|
||
(doom-modeline-env-version t)
|
||
(doom-modeline-buffer-file-name-style 'truncate-upto-project)
|
||
:config
|
||
(mu4e-alert-enable-mode-line-display))
|
||
#+end_src
|
||
|
||
** Pixel-perfect alignment of Markdown and org-mode tables
|
||
Usually, I have no issue with the alignment of the tables I write in
|
||
org-mode and (more rarely) Markdown. However, there are occurrences
|
||
where I’ll use a character that does not exactly respect my monospace
|
||
font, which messes with the alignment of the table (often when I do
|
||
linguistics stuff). A solution to this is the package ~valign~. A little
|
||
caveat though, as its name implies ~valign~ helps with vertical
|
||
alignment. If some lines are too high, they won’t exactly fit. Unless?
|
||
Unless ~valign-fancy-bar~ is set to ~t~.
|
||
|
||
For now, I disabled the hook with org-mode and markdown-mode because
|
||
it slows down opening these files quite a lot. I’ll re-enable the hook
|
||
once it is fixed.
|
||
#+begin_src emacs-lisp
|
||
(use-package valign
|
||
:defer t
|
||
:straight (:build t)
|
||
:after (org markdown-mode)
|
||
;; :hook ((org-mode markdown-mode) . valign-mode)
|
||
:custom ((valign-fancy-bar t)))
|
||
#+end_src
|
||
|
||
** Secret mode
|
||
Sometimes, I want to hide the text displayed by Emacs but not lock
|
||
altogether my computer. In this case, ~secret-mode~ comes in handy.
|
||
#+begin_src emacs-lisp
|
||
(use-package secret-mode
|
||
:defer t
|
||
:straight (secret-mode :build t
|
||
:type git
|
||
:host github
|
||
:repo "bkaestner/secret-mode.el"))
|
||
#+end_src
|
||
|
||
** Solaire: Incandescent Emacs
|
||
A common issue when you have a lot of windows opened in Emacs is
|
||
sometimes there’s just too much. Is the first window source code? Is
|
||
the other one just an open email? Oh, let’s not forget the ~*Messages*~
|
||
buffer open next to another source buffer.
|
||
|
||
Solaire-mode applies a subtle but useful tweak to your current colour
|
||
scheme: the background of programming buffers is slightly lighter than
|
||
the background of other buffers. (Or is it other buffers that have a
|
||
slightly darker background? I’m not sure.)
|
||
#+begin_src emacs-lisp
|
||
(use-package solaire-mode
|
||
:defer t
|
||
:straight (:build t)
|
||
:init (solaire-global-mode +1))
|
||
#+end_src
|
||
|
||
** Theme
|
||
You may have noticed I use the Nord theme pretty much everywhere on my
|
||
computer, why not Emacs? In my opinion, its aurora variant is nicer
|
||
than the default Nord theme since it is richer in colours --- just a
|
||
personal preference.
|
||
#+begin_src emacs-lisp
|
||
(use-package doom-themes
|
||
:straight (:build t)
|
||
:defer t
|
||
:init (load-theme 'doom-nord-aurora t))
|
||
#+end_src
|
||
|
||
** Rainbow Delimiters
|
||
This makes Lisp especially more readable, but it’s also nice to have
|
||
for any language that has delimiters like brackets too.
|
||
#+begin_src emacs-lisp
|
||
(use-package rainbow-delimiters
|
||
:straight (:build t)
|
||
:defer t
|
||
:hook (prog-mode . rainbow-delimiters-mode))
|
||
#+end_src
|
||
|
||
** Y’all want some more /COLOURS/?
|
||
It is possible to make info buffers much more colourful (and, in my
|
||
opinion, easier to read) with this simple package:
|
||
#+begin_src emacs-lisp
|
||
(use-package info-colors
|
||
:straight (:build t)
|
||
:commands info-colors-fnontify-node
|
||
:hook (Info-selection . info-colors-fontify-node)
|
||
:hook (Info-mode . mixed-pitch-mode))
|
||
#+end_src
|