(Emacs/config)+globalised olivetti mode

Now everything is aesthetically centred.
This commit is contained in:
2024-07-01 04:16:16 +01:00
parent 8df0051cc2
commit b50d05e5a9

View File

@@ -1314,35 +1314,25 @@ thing faster and within Emacs lisp. ~rgrep~ is useful though.
#+end_src #+end_src
** Olivetti ** Olivetti
Olivetti provides a focus mode for Emacs, which makes it look a bit Olivetti provides a focus mode for Emacs, which makes it look a bit
nicer with fringes. I also define ~+olivetti-mode~ which will nicer. It uses margins by default and centres using fill-column. I
remember and clear up any window configurations on the frame, then actually really like olivetti mode particularly with my [[*Mode
when turned off will reinsert them - provides a nice way to quickly line][centred mode-line]], so I also define a global minor mode which
focus on a buffer. enables it in all but the minibuffer.
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package olivetti (use-package olivetti
:straight t :straight t
:defer t :defer t
:commands (+olivetti-mode)
:general :general
(mode-leader (mode-leader
"o" #'+olivetti-mode) "o" #'olivetti-global-mode)
:init :init
(setq-default olivetti-body-width 0.6) (setq-default olivetti-body-width nil)
(setq olivetti-style 'fancy) (setq-default olivetti-minimum-body-width 100)
(add-hook 'olivetti-mode-on-hook (setq olivetti-style nil)
(proc (interactive) (text-scale-increase 1)))
(add-hook 'olivetti-mode-off-hook
(proc (interactive) (text-scale-decrease 1)))
:config :config
(defun +olivetti-mode () (define-globalized-minor-mode olivetti-global-mode olivetti-mode
(interactive) (lambda nil (unless (minibufferp)
(if (not olivetti-mode) (olivetti-mode 1)))))
(progn
(window-configuration-to-register 1)
(delete-other-windows)
(olivetti-mode t))
(jump-to-register 1)
(olivetti-mode 0))))
#+end_src #+end_src
** All the Icons ** All the Icons
Nice set of icons with a great user interface to manage them. Nice set of icons with a great user interface to manage them.