reformatting and straight.el

This commit is contained in:
Janis 2024-07-16 20:31:53 +02:00
parent d62e699d67
commit 0225ba4be3

365
init.org
View file

@ -41,18 +41,20 @@ https://github.com/noctuid/evil-guide?tab=readme-ov-file#keymap-precedence
** Tangling init.org
From Sophie's emacs.d:
#+begin_src emacs-lisp
(defun tangle-init ()
(defun tangle-init ()
"If the current buffer is init.org the code-blocks are
tangled, and the tangled file is compiled."
tangled, and the tangled file is compiled."
(when (equal (buffer-file-name)
(expand-file-name (concat user-emacs-directory "init.org")))
;; Avoid running hooks when tangling.
(let ((prog-mode-hook nil))
(org-babel-tangle)
(byte-compile-file (concat user-emacs-directory "init.el")))))
(byte-compile-file (concat user-emacs-directory "init.el"))
)))
(add-hook 'after-save-hook 'tangle-init)
(add-hook 'after-save-hook 'tangle-init)
#+end_src
** Startup performance
Usually, I like to run emacs as a daemon and only ever open new emacs clients, but that often doesn't work properly and definitely doesn't work when actively working on an emacs config, so this snippet might be useful.
#+begin_src emacs-lisp
@ -117,22 +119,50 @@ Backups / Auto-saves
Auto-save files:
#+begin_src emacs-lisp :tangle no
(use-package auto-save-buffers-enhanced
:ensure t
:straight t
:config
(auto-save-buffers-enhanced t)
(setq auto-save-buffers-enhanced-exclude-regexps '("init.org")))
#+end_src
** Package repositories
Use =straight=, and it's bootstrapping code:
#+begin_src emacs-lisp
(require 'package)
(require 'use-package)
(require 'use-package-ensure)
(setq use-package-always-ensure t)
(defvar bootstrap-version)
(let ((bootstrap-file
(expand-file-name
"straight/repos/straight.el/bootstrap.el"
(or (bound-and-true-p straight-base-dir)
user-emacs-directory)))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))
#+end_src
Disable =package.el= in the early init file:
#+begin_src emacs-lisp :tangle early-init.el
(setq package-enable-at-startup nil)
#+end_src
Then, install =use-package= and tell it to always assume =:straight=:
#+begin_src emacs-lisp
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
#+end_src
load org early to work around version mismatches:
#+begin_src emacs-lisp
(straight-use-package 'org)
#+end_src
Add package repositories and rank them by priority
#+begin_src emacs-lisp
#+begin_src emacs-lisp :tangle no
(setq package-archives
'(("GNU ELPA" . "https://elpa.gnu.org/packages/")
("MELPA" . "https://melpa.org/packages/")
@ -182,7 +212,7 @@ Add package repositories and rank them by priority
#+begin_src emacs-lisp
(use-package exec-path-from-shell
:ensure t
:straight t
:config
(when (daemonp)
(exec-path-from-shell-initialize)))
@ -190,6 +220,7 @@ Add package repositories and rank them by priority
#+begin_src emacs-lisp
(use-package keychain-environment
:straight t
:defer t
:config
(keychain-refresh-environment))
@ -205,6 +236,7 @@ Keymap:
:init-value t
:keymap custom-bindings-map)
#+end_src
* Visuals
** Borders, Frames & Windows
#+begin_src emacs-lisp
@ -215,20 +247,21 @@ Keymap:
(setq-default indicate-empty-lines nil)
(set-face-attribute 'header-line t :inherit 'default)
#+end_src
** Themes
Light theme for writing
#+begin_src emacs-lisp
(use-package gruvbox-theme
:ensure t)
:straight t)
#+end_src
[[https://github.com/doomemacs/themes][Doom Themes]] as default theme
#+begin_src emacs-lisp
;; doom needs this somehow
(use-package all-the-icons
:ensure t)
:straight t)
(use-package doom-themes
:ensure t
:straight t
:config
(setq doom-themes-enable-bold t
doom-themes-enable-italic t)
@ -260,6 +293,7 @@ Helper function for switching themes.
(interactive)
(load-theme nemo/dark-theme t))
#+end_src
** Fonts
Font size [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attributes.html][(height)]] in emacs works in $\frac{1}{10}$ths of points, so ~110~ is the same as ~11~ points.
#+begin_src emacs-lisp
@ -282,9 +316,11 @@ Font size [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Face-Attri
Use nerd-icons and apple emojis
#+begin_src emacs-lisp
(use-package nerd-icons)
(use-package nerd-icons
:straight t)
(use-package emojify
:straight t
:config
(when (member "Apple Color Emoji" (font-family-list))
(set-fontset-font t 'symbol (font-spec :family "Apple Color Emoji") nil 'prepend)))
@ -293,10 +329,12 @@ Use nerd-icons and apple emojis
Use both fixed and variable pitched fonts and faces.
#+begin_src emacs-lisp
(use-package mixed-pitch
:straight t
:defer t
:hook ((org-mode . mixed-pitch-mode)
(LaTeX-mode . mixed-pitch-mode)))
#+end_src
** Mode Line
Honestly not very happy with this at the moment, but it's kind of hacked together based on Sophie's and Amit's modelines.
#+begin_src emacs-lisp
@ -392,10 +430,12 @@ Honestly not very happy with this at the moment, but it's kind of hacked togethe
:inherit 'mode-line-position-face
:foreground "black" :background "#eab700")
#+end_src
* Packages
** Web Search
#+begin_src emacs-lisp
(use-package engine-mode
:straight t
:defer t
:config
(defengine duckduckgo
@ -424,11 +464,13 @@ Honestly not very happy with this at the moment, but it's kind of hacked togethe
(engine-mode t)
)
#+end_src
** =magit=
try out =diff-hl= for highlighting diffs in magit:
#+begin_src emacs-lisp
(use-package diff-hl
:straight t
:config
(global-diff-hl-mode))
#+end_src
@ -436,6 +478,7 @@ try out =diff-hl= for highlighting diffs in magit:
=magit= is awesome and the number one reason why I use Emacs!
#+begin_src emacs-lisp
(use-package magit
:straight t
:defer t
:config
(setq magit-mode-quit-window 'magit-restore-window-configuration
@ -447,6 +490,7 @@ try out =diff-hl= for highlighting diffs in magit:
#+begin_src emacs-lisp
(use-package magit-todos
:after magit
:straight t
:config
(magit-todos-mode t))
#+end_src
@ -454,6 +498,7 @@ try out =diff-hl= for highlighting diffs in magit:
And forge sounds cool as well.
#+begin_src emacs-lisp
(use-package forge
:straight t
:after magit)
#+end_src
@ -461,22 +506,25 @@ And forge sounds cool as well.
This is one of those features of Spacemacs that is super useful.
#+begin_src emacs-lisp
(use-package which-key
:straight t
:config
(which-key-mode))
#+end_src
** rainbow-delimiters
raimbow delimiters colours matching delimiters with different colours.
Used by Spacemacs as well.
#+begin_src emacs-lisp
(use-package rainbow-delimiters
:straight t
:hook (prog-mode . rainbow-delimiters-mode))
#+end_src
** evil
#+begin_src emacs-lisp
(use-package evil
:ensure t
:straight t
:init
(setq evil-want-C-u-scroll t)
(setq evil-want-keybinding nil)
@ -485,7 +533,7 @@ Used by Spacemacs as well.
(evil-mode 1)
#+end_src
Evil key-binds:
Evil key-binds, documentation for how this works is [[https://evil.readthedocs.io/en/latest/keymaps.html][here]]:
#+begin_src emacs-lisp
(evil-global-set-key 'normal (kbd "<SPC>TAB") 'mode-line-other-buffer)
(evil-define-key 'normal 'global (kbd "<SPC>bb") 'consult-buffer)
@ -506,13 +554,17 @@ I want to bind =SPC g s= to magit status, just how it is in spacemacs.
These bindings are somewhat different from spacemacs, which parents the insertion key binds under the major-mode prefix =m=.
With =TAB= I can cycle headings in org, and with =,,= I can exit the special source block editor.
#+begin_src emacs-lisp
(evil-define-key 'normal org-mode-map (kbd "TAB") 'org-cycle)
(evil-define-key 'normal 'org-mode-map (kbd ",,") 'org-edit-src-exit)
(evil-define-key 'normal 'org-mode-map (kbd "<SPC>ih") 'org-insert-heading)
(evil-define-key 'normal 'org-mode-map (kbd "<SPC>is") 'org-insert-subheading)
(evil-define-key 'normal 'org-mode-map (kbd "<SPC>ii") 'org-insert-item)
(evil-define-key 'normal 'org-mode-map (kbd "<SPC>ib") 'org-insert-structure-template)
(evil-define-key '(normal visual) 'org-mode-map (kbd "<SPC>il") 'org-insert-link)
(evil-define-key 'normal org-mode-map
(kbd "TAB") 'org-cycle
(kbd "RET") 'org-open-at-point
(kbd ",,") 'org-edit-src-exit
(kbd "<SPC>ih") 'org-insert-heading
(kbd "<SPC>is") 'org-insert-subheading
(kbd "<SPC>ii") 'org-insert-item
(kbd "<SPC>ib") 'org-insert-structure-template)
(evil-define-key '(normal visual) 'org-mode-map
(kbd "<SPC>il") 'org-insert-link)
#+end_src
Unassociated key-bindings:
@ -529,6 +581,7 @@ Close =:config=.
#+begin_src emacs-lisp
(use-package evil-surround
:straight t
:defer t
:config
(global-evil-surround-mode 1))
@ -537,7 +590,7 @@ Close =:config=.
#+begin_src emacs-lisp
(use-package evil-collection
:after evil
:ensure t
:straight t
:config
(evil-collection-init))
#+end_src
@ -546,12 +599,14 @@ Close =:config=.
Also use =undo-fu=, which evil can use.
#+begin_src emacs-lisp
(use-package undo-fu
:straight t
:defer t)
#+end_src
** Projectile
#+begin_src emacs-lisp
(use-package projectile
:straight t
:defer t
:config
(setq projectile-project-search-path '("~/code/"))
@ -561,19 +616,22 @@ Also use =undo-fu=, which evil can use.
** =ripgrep= & Co.
#+begin_src emacs-lisp
(use-package ripgrep
:straight t
:defer t)
(use-package rg
:straight t
:defer t)
#+end_src
** VTerm
#+begin_src emacs-lisp
(use-package vterm
:ensure t)
:straight t)
#+end_src
* Stuff
** Minibuffer escape
** Mini-buffer escape
#+begin_src emacs-lisp :tangle no
(setq minibuffer-prompt-properties
'(read-only t
@ -592,10 +650,12 @@ Also use =undo-fu=, which evil can use.
(global-set-key (kbd "<escape>") 'nemo/abort-minibuffer-if-active)
#+end_src
* Writing
** Olivetti
#+begin_src emacs-lisp
(use-package olivetti
:straight t
:defer t
; :bind (:map custom-bindings-map ("C-c o" . olivetti-mode))
:config
@ -603,9 +663,11 @@ Also use =undo-fu=, which evil can use.
(add-hook 'olivetti-mode-on-hook (lambda () (olivetti-set-width 88)))
#+end_src
** Spelling
#+begin_src emacs-lisp
(use-package jinx
:straight t
:hook (emacs-startup . global-jinx-mode)
:bind (("M-$" . jinx-correct)
("C-M-$" . jinx-languages))
@ -613,33 +675,48 @@ Also use =undo-fu=, which evil can use.
(evil-define-key 'normal 'global (kbd "<SPC>Ss") 'jinx-correct)
(setq jinx-languages "en_GB dk_DK de_DE"))
#+end_src
** LaTeX
#+begin_src emacs-lisp
(use-package auctex
(use-package auctex
:straight t
:hook
(LaTeX-mode . turn-on-prettify-symbols-mode)
(LaTeX-mode . reftex-mode)
; (LaTeX-mode . (lambda () (corfu-mode -1)))
; (LaTeX-mode . outline-minor-mode)
;; (LaTeX-mode . (lambda () (corfu-mode -1)))
;; (LaTeX-mode . outline-minor-mode)
(LaTeX-mode . olivetti-mode)
)
:config
(setq TeX-view-program-selection '((output-pdf "PDF Tools"))
TeX-view-program-list '(("PDF Tools" TeX-pdf-tools-sync-view))
TeX-source-correlate-start-server t))
#+end_src
PDF tools for latex previewing
PDF tools for latex previewing:
#+begin_src emacs-lisp
(use-package pdf-tools
(use-package pdf-tools
:straight t
:defer t
:init (pdf-loader-install))
:mode ("\\.pdf\\'" . pdf-view-mode)
:config
(pdf-loader-install)
(setq-default pdf-view-display-size 'fit-height)
(setq pdf-view-continuous nil)
(setq +latex-viewers '(pdf-tools))
(evil-define-key 'motion 'pdf-view-mode
"j" 'pdf-view-next-page
"k" 'pdf-view-previous-page))
#+end_src
** Org
Taken from [[https://sophiebos.io/posts/prettifying-emacs-org-mode/][ here]].
#+begin_src emacs-lisp
(use-package org
(use-package org
:straight t
:defer t
:hook (org-mode . olivetti-mode)
:hook (org-mode . variable-pitch-mode)
; I basically always want to be running =visual-line-mode= anyway, but certainly in org-mode.
;; I basically always want to be running =visual-line-mode= anyway, but certainly in org-mode.
:hook (org-mode . visual-line-mode)
:hook (org-mode . nemo/prettify-symbols-setup)
:config
@ -647,7 +724,7 @@ Taken from [[https://sophiebos.io/posts/prettifying-emacs-org-mode/][ here]].
Change heading font sizes:
#+begin_src emacs-lisp
(custom-set-faces
(custom-set-faces
'(org-document-title ((t (:height 1.8))))
'(outline-1 ((t (:height 1.35))))
'(outline-2 ((t (:height 1.3))))
@ -666,23 +743,23 @@ Open Org files with the content folded away:
Enable LaTeX previews.
#+begin_src emacs-lisp
(setq org-startup-with-latex-preview t)
(setq org-startup-with-latex-preview t)
#+end_src
Inline images as well.
#+begin_src emacs-lisp
(setq org-startup-with-inline-images t)
(setq org-startup-with-inline-images t)
#+end_src
In case LaTeX previews are too small, use this to increase them.
#+begin_src emacs-lisp
(plist-put org-format-latex-options :scale 1.35)
#+begin_src emacs-lisp
(plist-put org-format-latex-options :scale 1.35)
#+end_src
==pretty-entities= allows for latex symbols to be embedded into org-mode.
=org-hide-leading-stars= hides all but one star on org headings.
#+begin_src emacs-lisp
(setq org-adapt-indentation t
(setq org-adapt-indentation t
org-hide-leading-stars t
org-pretty-entities-include-sub-superscripts t
org-pretty-entities t)
@ -690,40 +767,43 @@ In case LaTeX previews are too small, use this to increase them.
Let emacs act according to the language's rules inside of a source block.
#+begin_src emacs-lisp
(setq org-src-fontify-natively t
(setq org-src-fontify-natively t
org-src-tab-acts-natively t
org-edit-src-content-indentation 0)
#+end_src
End =:config=
#+begin_src emacs-lisp
)
)
#+end_src
Use org-bullets for fancy headline markers
#+begin_src emacs-lisp :tangle no
(use-package org-bullets
(use-package org-bullets
:straight t
:hook (org-mode . (lambda () (org-bullets-mode 1)))
:config)
#+end_src
Use typo-mode in org-mode for en and em dashes:
#+begin_src emacs-lisp
(require 'typo)
#+begin_src emacs-lisp :tangle no
(require 'typo)
(typo-global-mode 1)
(add-hook 'org-mode-hook 'typo-mode)
(typo-global-mode 1)
(add-hook 'org-mode-hook 'typo-mode)
#+end_src
Use =org-fragtog= to show embedded LaTeX fragments when in insert mode.
#+begin_src emacs-lisp
(use-package org-fragtog
(use-package org-fragtog
:straight t
:hook (org-mode . org-fragtog-mode))
#+end_src
Using =org-appear= we can hide emphasis markers for italic, bold, etc. and show when editing the surrounded word.
#+begin_src emacs-lisp
(use-package org-appear
(use-package org-appear
:straight t
:commands (org-appear-mode)
:hook (org-mode . org-appear-mode)
:config
@ -734,7 +814,8 @@ Using =org-appear= we can hide emphasis markers for italic, bold, etc. and show
#+end_src
#+begin_src emacs-lisp
(use-package org-modern
(use-package org-modern
:straight t
:defer t
:after org
:hook (org-mode . org-modern-mode))
@ -742,9 +823,9 @@ Using =org-appear= we can hide emphasis markers for italic, bold, etc. and show
Change org face fonts and font sizes for headers.
#+begin_src emacs-lisp :tangle no
(require 'org-faces)
;; size org levels differently
(dolist (face '((org-document-title . 1.8)
(require 'org-faces)
;; size org levels differently
(dolist (face '((org-document-title . 1.8)
(org-level-1 . 1.35)
(org-level-2 . 1.3)
(org-level-3 . 1.2)
@ -764,24 +845,24 @@ Change org face fonts and font sizes for headers.
Fix org-indent to be fixed-pitch.
#+begin_src emacs-lisp :tangle no
(require 'org-indent)
(set-face-attribute 'org-indent nil :inherit '(org-hide fixed-pitch))
(require 'org-indent)
(set-face-attribute 'org-indent nil :inherit '(org-hide fixed-pitch))
#+end_src
Make sure that faces like code blocks or verbatim text are still using a monospaced font:
#+begin_src emacs-lisp :tangle no
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch :height 0.85)
(set-face-attribute 'org-code nil :foreground nil :inherit '(shadow fixed-pitch) :height 0.85)
(set-face-attribute 'org-indent nil :foreground nil :inherit '(org-hide fixed-pitch) :height 0.85)
(set-face-attribute 'org-verbatim nil :foreground nil :inherit '(shadow fixed-pitch) :height 0.85)
(set-face-attribute 'org-special-keyword nil :foreground nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :foreground nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :foreground nil :inherit 'fixed-pitch)
(set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch :height 0.85)
(set-face-attribute 'org-code nil :foreground nil :inherit '(shadow fixed-pitch) :height 0.85)
(set-face-attribute 'org-indent nil :foreground nil :inherit '(org-hide fixed-pitch) :height 0.85)
(set-face-attribute 'org-verbatim nil :foreground nil :inherit '(shadow fixed-pitch) :height 0.85)
(set-face-attribute 'org-special-keyword nil :foreground nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-meta-line nil :foreground nil :inherit '(font-lock-comment-face fixed-pitch))
(set-face-attribute 'org-checkbox nil :foreground nil :inherit 'fixed-pitch)
#+end_src
prettify symbols for quotes and source blocks in org-mode.
#+begin_src emacs-lisp
(defun nemo/prettify-symbols-setup ()
(defun nemo/prettify-symbols-setup ()
;; org-babel
(push '("#+BEGIN_SRC" . ?≫) prettify-symbols-alist)
(push '("#+END_SRC" . ?≫) prettify-symbols-alist)
@ -796,41 +877,45 @@ prettify symbols for quotes and source blocks in org-mode.
=svg-tags-mode= for fancy SVG images
#+begin_src emacs-lisp
(use-package svg-tag-mode
(use-package svg-tag-mode
:straight t
:config
(setq svg-tag-tags
'((":TODO:" . ((lambda (tag) (svg-tag-make "TODO"))))))
)
#+end_src
#+end_src
* Agenda
** org-agenda
#+begin_src emacs-lisp
(require 'org)
(require 'org)
(setq org-agenda-start-on-weekday nil
(setq org-agenda-start-on-weekday nil
org-agenda-block-separator nil
org-agenda-remove-tags t)
(use-package org-super-agenda
(use-package org-super-agenda
:straight t
:after org
:config
(org-super-agenda-mode))
(setq org-agenda-files (list "~/Shared/agenda.org"
(setq org-agenda-files (list "~/Shared/agenda.org"
"~/notes.org"
"~/projects.org"))
(add-hook 'emacs-startup-hook
(add-hook 'emacs-startup-hook
(lambda () (progn (org-agenda nil "a")
(delete-other-windows)
(olivetti-mode))))
#+end_src
* Navigation / mini-buffer
Realistically, I will probably never use 90% of Helm's functionality, so =vertico= should be sufficient.
** Move Text
Use the =move-text= package to move the current line or selection up or down with =M-j= and =M-k=.
#+begin_src emacs-lisp
(use-package move-text
:straight t
:defer t
:bind (("M-j" . move-text-down)
("M-k" . move-text-up)))
@ -839,6 +924,7 @@ Use the =move-text= package to move the current line or selection up or down wit
** Treemacs
#+begin_src emacs-lisp
(use-package treemacs
:straight t
:defer t
;; hijack projectile prefix because they fit together
:bind (("C-x p t" . treemacs))
@ -847,23 +933,25 @@ Use the =move-text= package to move the current line or selection up or down wit
(use-package treemacs-evil
:after (treemacs evil)
:ensure t)
:straight t)
(use-package treemacs-projectile
:after (treemacs projectile)
:ensure t)
:straight t)
(use-package treemacs-icons-dired
:hook (dired-mode . treemacs-icons-dired-enable-once)
:ensure t)
:straight t)
(use-package treemacs-magit
:after (treemacs magit)
:ensure t)
:straight t)
#+end_src
** Vertico
#+begin_src emacs-lisp
(use-package vertico
:straight t
:bind (:map minibuffer-local-map
("C-h" . backward-kill-sexp))
:config
@ -879,6 +967,7 @@ Use the =move-text= package to move the current line or selection up or down wit
Use =vertico-posframe= to make the =vertico= buffer floating in the centre of the frame.
#+begin_src emacs-lisp
(use-package vertico-posframe
:straight t
:config
(vertico-posframe-mode 1)
(setq vertico-posframe-height vertico-count
@ -889,12 +978,15 @@ Use =vertico-posframe= to make the =vertico= buffer floating in the centre of th
(t posframe))
))
(use-package savehist :init (savehist-mode))
(use-package savehist
:straight t
:init (savehist-mode))
#+end_src
Use =consult-xref= for =lsp-xref= and =xref-find-references=.
#+begin_src emacs-lisp
(use-package consult
(use-package consult
:straight t
:bind (:map custom-bindings-map
("C-x b" . consult-buffer)
("M-g g" . consult-goto-line))
@ -907,7 +999,8 @@ Use =consult-xref= for =lsp-xref= and =xref-find-references=.
[[https://github.com/minad/marginalia][=marginalia=]] adds marginalia into the mini-buffer, for example key-binds in =M-x=
#+begin_src emacs-lisp
(use-package marginalia
(use-package marginalia
:straight t
:init
(marginalia-mode 1))
#+end_src
@ -915,6 +1008,7 @@ Use =consult-xref= for =lsp-xref= and =xref-find-references=.
Auto-completion using =corfu=:
#+begin_src emacs-lisp
(use-package corfu
:straight t
:custom
;; Enable auto completion
(corfu-auto t)
@ -931,6 +1025,15 @@ Auto-completion using =corfu=:
:init
(global-corfu-mode))
(use-package corfu-terminal
:straight t
:defer t
:hook (before-make-frame .
(lambda ()
(corfu-terminal-mode
(if (display-graphic-p) -1 +1))))
)
(use-package emacs
:custom
;; TODO
@ -951,9 +1054,36 @@ Auto-completion using =corfu=:
(setq tab-always-indent 'complete))
#+end_src
Use =kind-icon= to decorate corfu completion candidates:
#+begin_src emacs-lisp
(use-package kind-icon
:straight t
:after corfu
:config
(add-to-list 'corfu-margin-formatters #'kind-icon-margin-formatter))
#+end_src
Use =prescient= to sort completion candidates:
#+begin_src emacs-lisp :tangle no
(use-package prescient
:straight t
:after corfu
:defer t
:config
(add-to-list 'prescient-filter-method 'fuzzy))
(use-package corfu-prescient
:straight t
:after corfu
:straight t
:config
(corfu-prescient-mode 1))
#+end_src
This package seems to slow down search quite a bit in common buffers like find-file and exectue-extended-comand:
#+begin_src emacs-lisp :tangle no
(use-package cape
(use-package cape
:straight t
;; Bind dedicated completion commands
;; Alternative prefix keys: C-c p, M-p, M-+, ...
:bind (("C-c p p" . completion-at-point) ;; capf
@ -991,8 +1121,8 @@ This package seems to slow down search quite a bit in common buffers like find-f
Fuzzy and out-of-order completion matching using =orderless=:
#+begin_src emacs-lisp
(use-package orderless
:ensure t
(use-package orderless
:straight t
:config
(setq completion-styles '(orderless basic partial-completion)
orderless-matching-styles '(orderless-flex)
@ -1003,49 +1133,60 @@ Fuzzy and out-of-order completion matching using =orderless=:
Use =embark= for in-mini-buffer actions:
#+begin_src emacs-lisp
(use-package embark
:straight t
:defer t
:bind (("C-." . embark-act))
:config
())
(use-package embark-consult
:straight t
:defer t
:hook (embark-collect-mode . consult-preview-at-point-mode))
#+end_src
#+begin_src emacs-lisp
(defun my-consult-line-wrapper ()
(defun my-consult-line-wrapper ()
(interactive)
(vertico-posframe-mode -1)
(consult-line)
(vertico-posframe-mode 1))
(defun my-consult-ripgrep-wrapper ()
(defun my-consult-ripgrep-wrapper ()
(interactive)
(vertico-posframe-mode -1)
(consult-ripgrep)
(vertico-posframe-mode 1))
(bind-key "C-s" 'consult-line custom-bindings-map)
(bind-key "C-M-s" 'consult-ripgrep custom-bindings-map)
(bind-key "C-s" 'consult-line custom-bindings-map)
(bind-key "C-M-s" 'consult-ripgrep custom-bindings-map)
; Ensure posframe is always restored when exiting a minibuffer
(add-hook 'minibuffer-exit-hook
; Ensure posframe is always restored when exiting a minibuffer
(add-hook 'minibuffer-exit-hook
(lambda ()
(vertico-posframe-mode 1)))
#+end_src
* Programming
Enable =hs-minor-mode= in =prog-mode= to allow for folding away comments and modules/namespaces:
#+begin_src emacs-lisp
(add-hook 'prog-mode-hook 'hs-minor-mode)
#+end_src
** smart-parens
#+begin_src emacs-lisp
(use-package smartparens
(use-package smartparens
:straight t
:defer t
:hook ((prog-mode text-mode markdown-mode) . smartparens-mode)
:config
(require 'smartparens-config))
#+end_src
** Company
#+begin_src emacs-lisp :tangle no
(use-package company
:straight t
:defer t
:hook (after-init . company-mode)
:hook (prog-mode . company-mode)
@ -1058,6 +1199,7 @@ Use =embark= for in-mini-buffer actions:
Use =ispell= with company mode for completion in text-modes
#+begin_src emacs-lisp
(use-package ispell
:straight t
:defer t
:config
(setq ispell-dictionary "en_GB"))
@ -1065,20 +1207,23 @@ Use =ispell= with company mode for completion in text-modes
** Flycheck
#+begin_src emacs-lisp
(use-package flycheck
(use-package flycheck
:straight t
:defer t
:hook (after-init. global-flycheck-mode)
:config)
#+end_src
** Yasnippet
Auto-completion requires yasnippet for some competions, such as function arguments and parens.
#+begin_src emacs-lisp
(use-package yasnippet
(use-package yasnippet
:straight t
:defer t
:hook ((prog-mode text-mode) . yas-minor-mode))
(use-package yasnippet-snippets
:ensure t)
(use-package yasnippet-snippets
:straight t)
#+end_src
** LSP
@ -1087,6 +1232,7 @@ Emacs has its own internal LSP client called eglot, but I've never used it and I
LSP sets it's prefix key to =s-l= by default, which uses the Super key which I use as my Mod key in sway, so I can't use it in emacs.
#+begin_src emacs-lisp
(use-package lsp-mode
:straight t
:defer t
:hook (prog-mode . lsp)
:hook (lsp-mode . lsp-enable-which-key-integration)
@ -1111,6 +1257,7 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
)
(use-package lsp-treemacs
:straight t
:commands lsp-treemacs-errors-list)
(use-package lsp-ui
@ -1132,7 +1279,8 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
** Rust
[[https://github.com/rust-lang/rust-mode][rust-mode]]
#+begin_src emacs-lisp
(use-package rust-mode
(use-package rust-mode
:straight t
:defer t
:hook (rust-mode . lsp)
:init
@ -1142,20 +1290,36 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
#+end_src
#+begin_src emacs-lisp
(use-package rust-playground
(use-package rust-playground
:straight t
:defer t)
#+end_src
[[https://github.com/kwrooijen/cargo.el][cargo-mode]]
#+begin_src emacs-lisp
(use-package cargo-mode
(use-package cargo-mode
:straight t
:defer t
:hook (rust-mode . cargo-minor-mode))
:hook (rust-mode . cargo-minor-mode)
:config
(setq cargo-mode-command-test "test -- --nocapture"))
#+end_src
** Debugging
#+begin_src emacs-lisp
(use-package dap-mode
:straight t
:defer t
:config
(require 'dap-cpptools)
(dap-cpptools-setup)
(dap-auto-configure-mode 1))
#+end_src
** Web
#+begin_src emacs-lisp
(use-package web-mode
(use-package web-mode
:straight t
:defer t
:mode
(("\\.phtml\\'" . web-mode)
@ -1187,7 +1351,8 @@ LSP sets it's prefix key to =s-l= by default, which uses the Super key which I u
** C/C++
clang-format
#+begin_src emacs-lisp
(use-package clang-format
(use-package clang-format
:straight t
:defer t)
#+end_src