summaryrefslogtreecommitdiff
path: root/dot_config/emacs/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'dot_config/emacs/lisp')
-rw-r--r--dot_config/emacs/lisp/avy-config.el176
-rw-r--r--dot_config/emacs/lisp/completion-config.el104
-rw-r--r--dot_config/emacs/lisp/doom-quit.el62
-rw-r--r--dot_config/emacs/lisp/editing-config.el41
-rw-r--r--dot_config/emacs/lisp/elfeed-config.el32
-rw-r--r--dot_config/emacs/lisp/emacs-config.el280
-rw-r--r--dot_config/emacs/lisp/email-config.el3
-rw-r--r--dot_config/emacs/lisp/embark-config.el11
-rw-r--r--dot_config/emacs/lisp/evil-config.el132
-rw-r--r--dot_config/emacs/lisp/git-config.el24
-rw-r--r--dot_config/emacs/lisp/gptel-config.el24
-rw-r--r--dot_config/emacs/lisp/irc-config.el35
-rw-r--r--dot_config/emacs/lisp/lsp-mode-config.el169
-rw-r--r--dot_config/emacs/lisp/meow-config.el233
-rw-r--r--dot_config/emacs/lisp/org-demo-macro.el66
-rw-r--r--dot_config/emacs/lisp/org-mode-config.el165
-rw-r--r--dot_config/emacs/lisp/pretty-config.el31
-rw-r--r--dot_config/emacs/lisp/reading-config.el26
-rw-r--r--dot_config/emacs/lisp/shell-config.el26
19 files changed, 1640 insertions, 0 deletions
diff --git a/dot_config/emacs/lisp/avy-config.el b/dot_config/emacs/lisp/avy-config.el
new file mode 100644
index 0000000..50c14ce
--- /dev/null
+++ b/dot_config/emacs/lisp/avy-config.el
@@ -0,0 +1,176 @@
+;;; tweaked from karthink's .emacs.d
+
+(use-package avy
+ :ensure t
+ :commands (avy-goto-word-1 avy-goto-char-2 avy-goto-char-timer)
+ :config
+ (setq avy-timeout-seconds 0.4)
+ (setq avy-keys '(?a ?r ?s ?t ?g ?m ?n ?e ?i ?o ?'
+ ?q ?w ?f ?p ?b ?j ?l ?u ?y ?\; ?-
+ ?z ?x ?c ?d ?v ?k ?h ?, ?. ?/))
+
+ (setq avy-single-candidate-jump nil)
+ (setq avy-dispatch-alist '((?m . avy-action-mark)
+ (?$ . avy-action-ispell)
+ (?z . avy-action-zap-to-char)
+ (? . avy-action-embark)
+ (?= . avy-action-define)
+ (23 . avy-action-zap-to-char)
+ (?c . avy-action-mark-to-char)
+ (?h . avy-action-helpful)
+ (?x . avy-action-exchange)
+
+ (11 . avy-action-kill-line)
+ (25 . avy-action-yank-line)
+
+ (?w . avy-action-easy-kill)
+ (?k . avy-action-kill-stay)
+ (?y . avy-action-yank)
+ (?t . avy-action-teleport)
+
+ (?W . avy-action-copy-whole-line)
+ (?K . avy-action-kill-whole-line)
+ (?Y . avy-action-yank-whole-line)
+ (?T . avy-action-teleport-whole-line)))
+
+ ;; Improved to include transposition by hylophile
+ (defun avy-action-easy-kill (pt)
+ (unless (require 'easy-kill nil t)
+ (user-error "Easy Kill not found, please install."))
+ (cl-letf* ((bounds (cond
+ ((use-region-p)
+ (prog1 (cons (region-beginning) (region-end))
+ (deactivate-mark)))
+ ((bounds-of-thing-at-point 'sexp))
+ (t (cons (point) (point)))))
+ (transpose-map
+ (define-keymap
+ "M-t" (lambda () (interactive "*")
+ (pcase-let ((`(,beg . ,end) (easy-kill--bounds)))
+ (transpose-regions (car bounds) (cdr bounds) beg end
+ 'leave-markers)))))
+ ((symbol-function 'easy-kill-activate-keymap)
+ (lambda ()
+ (let ((map (easy-kill-map)))
+ (set-transient-map
+ (make-composed-keymap transpose-map map)
+ (lambda ()
+ ;; Prevent any error from activating the keymap forever.
+ (condition-case err
+ (or (and (not (easy-kill-exit-p this-command))
+ (or (eq this-command
+ (lookup-key map (this-single-command-keys)))
+ (let ((cmd (key-binding
+ (this-single-command-keys) nil t)))
+ (command-remapping cmd nil (list map)))))
+ (ignore
+ (easy-kill-destroy-candidate)
+ (unless (or (easy-kill-get mark) (easy-kill-exit-p this-command))
+ (easy-kill-save-candidate))))
+ (error (message "%s:%s" this-command (error-message-string err))
+ nil)))
+ (lambda ()
+ (let ((dat (ring-ref avy-ring 0)))
+ (select-frame-set-input-focus
+ (window-frame (cdr dat)))
+ (select-window (cdr dat))
+ (goto-char (car dat)))))))))
+ (goto-char pt)
+ (easy-kill)))
+
+ (defun avy-action-exchange (pt)
+ "Exchange sexp at PT with the one at point."
+ (set-mark pt)
+ (transpose-sexps 0))
+
+ (defun avy-action-helpful (pt)
+ (save-excursion
+ (goto-char pt)
+ (call-interactively #'display-local-help))
+ (select-window
+ (cdr (ring-ref avy-ring 0)))
+ t)
+
+ (defun avy-action-define (pt)
+ (cl-letf (((symbol-function 'keyboard-quit)
+ #'abort-recursive-edit))
+ (save-excursion
+ (goto-char pt)
+ (dictionary-search-dwim))
+ (select-window
+ (cdr (ring-ref avy-ring 0))))
+ t)
+
+ (defun avy-action-embark (pt)
+ (unwind-protect
+ (save-excursion
+ (goto-char pt)
+ (embark-act))
+ (select-window
+ (cdr (ring-ref avy-ring 0))))
+ t)
+
+ (defun avy-action-kill-line (pt)
+ (unwind-protect
+ (save-excursion
+ (goto-char pt)
+ (kill-line))
+ (avy-resume))
+ (select-window
+ (cdr (ring-ref avy-ring 0)))
+ t)
+
+ (defun avy-action-copy-whole-line (pt)
+ (save-excursion
+ (goto-char pt)
+ (cl-destructuring-bind (start . end)
+ (bounds-of-thing-at-point 'line)
+ (copy-region-as-kill start end)))
+ (select-window
+ (cdr
+ (ring-ref avy-ring 0)))
+ t)
+
+ (defun avy-action-kill-whole-line (pt)
+ (unwind-protect
+ (save-excursion
+ (goto-char pt)
+ (kill-whole-line)
+ (avy-resume)))
+ (select-window
+ (cdr
+ (ring-ref avy-ring 0)))
+ t)
+
+ (defun avy-action-yank-whole-line (pt)
+ (avy-action-copy-whole-line pt)
+ (save-excursion (yank))
+ t)
+
+ (defun avy-action-teleport-whole-line (pt)
+ (avy-action-kill-whole-line pt)
+ (save-excursion (yank)) t)
+
+ (defun avy-action-mark-to-char (pt)
+ (activate-mark)
+ (goto-char pt))
+
+ :bind (("C-M-'" . avy-resume)
+ ("C-'" . avy-goto-char-this-window)
+ ("M-j" . avy-goto-char-timer)
+ ("M-s y" . avy-copy-line)
+ ("M-s M-y" . avy-copy-region)
+ ("M-s M-k" . avy-kill-whole-line)
+ ("M-s j" . avy-goto-char-2)
+ ("M-s M-p" . avy-goto-line-above)
+ ("M-s M-n" . avy-goto-line-below)
+ ("M-s M-l" . avy-goto-end-of-line)
+ ("M-s C-w" . avy-kill-region)
+ ("M-s M-w" . avy-kill-ring-save-region)
+ ("M-s t" . avy-move-line)
+ ("M-s M-t" . avy-move-region)
+ :map isearch-mode-map
+ ("C-'" . avy-isearch)
+ ("M-j" . avy-isearch)))
+
+(provide 'avy-config)
diff --git a/dot_config/emacs/lisp/completion-config.el b/dot_config/emacs/lisp/completion-config.el
new file mode 100644
index 0000000..75c184a
--- /dev/null
+++ b/dot_config/emacs/lisp/completion-config.el
@@ -0,0 +1,104 @@
+;; Modern interactive completion framework for the minibuffer
+(use-package vertico
+ :hook
+ (after-init . vertico-mode) ;; Enable vertico after Emacs has initialized.
+ :custom
+ (vertico-cycle nil) ;; Do not cycle through candidates when reaching the end of the list.
+ :config
+ ;; Customize the display of the current candidate in the completion list.
+ ;; This will prefix the current candidate with “» ” to make it stand out.
+ ;; Reference: https://github.com/minad/vertico/wiki#prefix-current-candidate-with-arrow
+ (advice-add #'vertico--format-candidate :around
+ (lambda (orig cand prefix suffix index _start)
+ (setq cand (funcall orig cand prefix suffix index _start))
+ (concat
+ (if (= vertico--index index)
+ (propertize "» " 'face '(:foreground "#80adf0" :weight bold))
+ " ")
+ cand))))
+
+(use-package which-key
+ :ensure nil
+ :config
+ (which-key-mode 1))
+
+(use-package orderless
+ :defer t ;; Load Orderless on demand.
+ :after vertico ;; Ensure Vertico is loaded before Orderless.
+ :init
+ (setq completion-styles '(orderless basic) ;; Set the completion styles.
+ completion-category-defaults nil ;; Clear default category settings.
+ completion-category-overrides '((file (styles partial-completion))))) ;; Customize file completion styles.
+
+;; Marginalia enhances the completion experience in Emacs by adding
+;; additional context to the completion candidates. This includes
+;; helpful annotations such as documentation and other relevant
+;; information, making it easier to choose the right option.
+(use-package marginalia
+ :hook
+ (after-init . marginalia-mode))
+
+;;; CONSULT
+;; Consult provides powerful completion and narrowing commands for Emacs.
+;; It integrates well with other completion frameworks like Vertico, enabling
+;; features like previews and enhanced register management. It's useful for
+;; navigating buffers, files, and xrefs with ease.
+(use-package consult
+ :ensure t
+ :defer t
+ :init
+ ;; Enhance register preview with thin lines and no mode line.
+ (advice-add #'register-preview :override #'consult-register-window)
+
+ ;; Use Consult for xref locations with a preview feature.
+ (setq xref-show-xrefs-function #'consult-xref
+ xref-show-definitions-function #'consult-xref)
+
+ :bind (;; C-x bindings in `ctl-x-map'
+ ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
+ ("C-x b" . consult-buffer) ;; orig. switch-to-buffer
+ ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
+ ("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
+ ("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
+ ("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
+ ("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
+ ;; Custom M-# bindings for fast register access
+ ("M-#" . consult-register-load)
+ ("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
+ ("C-M-#" . consult-register)
+ ;; Other custom bindings
+ ("M-y" . consult-yank-pop) ;; orig. yank-pop
+ ;; M-g bindings in `goto-map'
+ ("M-g e" . consult-compile-error)
+ ("M-g r" . consult-grep-match)
+ ("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
+ ("M-g g" . consult-goto-line) ;; orig. goto-line
+ ("M-g M-g" . consult-goto-line) ;; orig. goto-line
+ ("M-g o" . consult-outline) ;; Alternative: consult-org-heading
+ ("M-g m" . consult-mark)
+ ("M-g k" . consult-global-mark)
+ ("M-g i" . consult-imenu)
+ ("M-g I" . consult-imenu-multi)
+ ;; M-s bindings in `search-map'
+ ("M-s d" . consult-find) ;; Alternative: consult-fd
+ ("M-s c" . consult-locate)
+ ("M-s g" . consult-grep)
+ ("M-s G" . consult-git-grep)
+ ("M-s r" . consult-ripgrep)
+ ("M-s l" . consult-line)
+ ("M-s L" . consult-line-multi)
+ ("M-s k" . consult-keep-lines)
+ ("M-s u" . consult-focus-lines)
+ ;; Isearch integration
+ ("M-s e" . consult-isearch-history)
+ :map isearch-mode-map
+ ("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
+ ("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
+ ("M-s l" . consult-line) ;; needed by consult-line to detect isearch
+ ("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
+ ;; Minibuffer history
+ :map minibuffer-local-map
+ ("M-s" . consult-history) ;; orig. next-matching-history-element
+ ("M-r" . consult-history))) ;; orig. previous-matching-history-element
+
+(provide 'completion-config)
diff --git a/dot_config/emacs/lisp/doom-quit.el b/dot_config/emacs/lisp/doom-quit.el
new file mode 100644
index 0000000..009aff0
--- /dev/null
+++ b/dot_config/emacs/lisp/doom-quit.el
@@ -0,0 +1,62 @@
+(defvar +doom-quit-messages
+ `(;; from Doom 1
+ "Please don't leave, there's more demons to toast!"
+ "Let's beat it -- This is turning into a bloodbath!"
+ ,(format "I wouldn't leave if I were you. %s is much worse."
+ (if (featurep :system 'windows) "DOS" "UNIX"))
+ "Don't leave yet -- There's a demon around that corner!"
+ "Ya know, next time you come in here I'm gonna toast ya."
+ "Go ahead and leave. See if I care."
+ "Are you sure you want to quit this great editor?"
+ ;; from Doom 2
+ ,(format "Don't go now, there's a dimensional shambler waiting at the %s prompt!"
+ (if (featurep :system 'windows) "DOS" "UNIX"))
+ "Get outta here and go back to your boring operating system."
+ "Look, bud. You leave now and you forfeit your body count!"
+ "Just leave. When you come back, I'll be waiting with a bat."
+ "You're lucky I don't smack you for thinking about leaving."
+ ;; from Portal
+ "Thank you for participating in this Aperture Science computer-aided enrichment activity."
+ "You can't fire me, I quit!"
+ "I don't know what you think you are doing, but I don't like it. I want you to stop."
+ "This isn't brave. It's murder. What did I ever do to you?"
+ "I'm the man who's going to burn your house down! With the lemons!"
+ "Okay, look. We've both said a lot of things you're going to regret..."
+ ;; Custom
+ "(setq nothing t everything 'permitted)"
+ "Emacs will remember that."
+ "Emacs, Emacs never changes."
+ "Hey! Hey, M-x listen!"
+ "It's not like I'll miss you or anything, b-baka!"
+ "Wake up, Mr. Stallman. Wake up and smell the ashes."
+ "You are *not* prepared!"
+ "Please don't go. The drones need you. They look up to you."
+ "Don't forget, you're here forever.")
+ "A list of quit messages, picked randomly by `+doom-quit'. Taken from
+http://doom.wikia.com/wiki/Quit_messages and elsewhere.")
+
+(defun +doom-quit-fn (&rest _)
+ (doom-quit-p
+ (format "%s %s"
+ (propertize (nth (random (length +doom-quit-messages))
+ +doom-quit-messages)
+ 'face '(italic default))
+ "Really quit Emacs?")))
+
+
+(defun doom-quit-p (&optional prompt)
+ (if use-dialog-box
+ (x-popup-dialog
+ t `("Really quit Emacs?"
+ ("Yes" . t)
+ ("Cancel" . nil)))
+ (let ((confirmed (y-or-n-p (format "%s" (or prompt "Really quit Emacs?")))))
+ (if confirmed
+ t
+ (progn
+ (message "Aborted")
+ nil)))))
+
+(setq confirm-kill-emacs #'+doom-quit-fn)
+
+(provide 'doom-quit)
diff --git a/dot_config/emacs/lisp/editing-config.el b/dot_config/emacs/lisp/editing-config.el
new file mode 100644
index 0000000..3df8a99
--- /dev/null
+++ b/dot_config/emacs/lisp/editing-config.el
@@ -0,0 +1,41 @@
+(use-package expreg
+ :bind
+ ("C-=" . expreg-expand)
+ :config
+ (defvar expreg-repeat-map
+ (let ((map (make-sparse-keymap)))
+ (define-key map "=" #'expreg-expand)
+ (define-key map "-" #'expreg-contract)
+ map))
+ (put 'expreg-expand 'repeat-map 'expreg-repeat-map)
+ (put 'expreg-contract 'repeat-map 'expreg-repeat-map))
+
+(use-package surround
+ :ensure t
+ :bind-keymap ("M-'" . surround-keymap))
+
+(use-package easy-kill
+ :config
+ (global-set-key [remap kill-ring-save] 'easy-kill)
+ (global-set-key [remap mark-sexp] 'easy-mark))
+
+(use-package devil
+ :config
+ (global-devil-mode 1))
+
+(use-package ace-window
+ :config
+ (global-set-key (kbd "s-w") 'ace-window)
+ (global-set-key [remap other-window] 'ace-window))
+
+(use-package vundo
+ :bind (("C-x u" . vundo)))
+
+(use-package multiple-cursors
+ :ensure t
+ :bind (("C-c g" . mc/mark-all-dwim)
+ ("C->" . mc/mark-next-like-this)
+ ("C-<" . mc/mark-previous-like-this)
+ ("M-<mouse-1>" . mc/add-cursor-on-click)))
+
+(provide 'editing-config)
diff --git a/dot_config/emacs/lisp/elfeed-config.el b/dot_config/emacs/lisp/elfeed-config.el
new file mode 100644
index 0000000..9d93327
--- /dev/null
+++ b/dot_config/emacs/lisp/elfeed-config.el
@@ -0,0 +1,32 @@
+(use-package elfeed
+ :defer t
+ :custom
+ (elfeed-use-curl t)
+ (elfeed-db-directory "~/.config/emacs/elfeed")
+
+ :config
+ ;; Mark all YouTube entries
+ (defun browse-url-mpv (url &optional _new-window)
+ (start-process "mpv" nil "mpv" url))
+
+ (setq browse-url-browser-function
+ '(("https://\\(www\\.\\)?youtu\\(\\.be\\|be\\.com\\)" . browse-url-mpv)
+ ("." . browse-url-default-browser)))
+ (add-hook 'elfeed-new-entry-hook
+ (elfeed-make-tagger :feed-url "youtube\\.com"
+ :add '(video youtube)))
+ :bind
+ ("C-c e" . elfeed))
+
+(use-package elfeed-protocol
+ :ensure t
+ :after elfeed
+ :config
+ (setq elfeed-feeds nil)
+ (setq elfeed-use-curl t)
+ (setq elfeed-feeds '(("fever+https://sakamoto@rss.sakamoto.network"
+ :api-url "https://rss.sakamoto.network/fever/"
+ :password (password-store-get "rss"))))
+ (elfeed-protocol-enable))
+
+(provide 'elfeed-config)
diff --git a/dot_config/emacs/lisp/emacs-config.el b/dot_config/emacs/lisp/emacs-config.el
new file mode 100644
index 0000000..bfc15ee
--- /dev/null
+++ b/dot_config/emacs/lisp/emacs-config.el
@@ -0,0 +1,280 @@
+(use-package emacs
+ :ensure nil
+ :custom
+ (user-mail-address "me@sakamoto.network")
+ (user-full-name "Sakamoto")
+ (mml-secure-openpgp-sign-with-sender t)
+ (message-sendmail-envelope-from 'header)
+ (auto-save-default nil) ;; Disable automatic saving of buffers.
+ (column-number-mode t) ;; Display the column number in the mode line.
+ (create-lockfiles nil) ;; Prevent the creation of lock files when editing.
+ (delete-by-moving-to-trash t) ;; Move deleted files to the trash instead of permanently deleting them.
+ (delete-selection-mode 1) ;; Enable replacing selected text with typed text.
+ (display-line-numbers-type 'relative) ;; Use relative line numbering in programming modes.
+ (global-auto-revert-non-file-buffers t) ;; Automatically refresh non-file buffers.
+ (history-length 100) ;; Set the length of the command history.
+ (indent-tabs-mode nil) ;; Disable the use of tabs for indentation (use spaces instead).
+ (inhibit-startup-message t) ;; Disable the startup message when Emacs launches.
+ (initial-scratch-message "") ;; Clear the initial message in the *scratch* buffer.
+ (ispell-program-name "hunspell")
+ (ispell-dictionary "en_US")
+ (shr-use-colors nil)
+ (blink-cursor-mode nil)
+ (make-backup-files nil) ;; Disable creation of backup files.
+ (pixel-scroll-precision-mode t) ;; Enable precise pixel scrolling.
+ (pixel-scroll-precision-use-momentum nil) ;; Disable momentum scrolling for pixel precision.
+ (fill-column 80) ;; Set column fill
+ (ring-bell-function 'ignore) ;; Disable the audible bell.
+ (split-width-threshold 300) ;; Prevent automatic window splitting if the window width exceeds 300 pixels.
+ (switch-to-buffer-obey-display-actions t) ;; Make buffer switching respect display actions.
+ (tab-always-indent 'complete) ;; Make the TAB key complete text instead of just indenting.
+ (tab-width 4) ;; Set the tab width to 4 spaces.
+ (treesit-font-lock-level 4) ;; Use advanced font locking for Treesit mode.
+ (truncate-lines t) ;; Enable line truncation to avoid wrapping long lines.
+ (global-visual-line-mode 1) ;; Soft wrap text
+ (global-visual-wrap-prefix-mode t)
+ (use-dialog-box nil) ;; Disable dialog boxes in favor of minibuffer prompts.
+ (use-short-answers t) ;; Use short answers in prompts for quicker responses (y instead of yes)
+ (warning-minimum-level :emergency) ;; Set the minimum level of warnings to display.
+ (help-window-select t)
+ (repeat-mode 1)
+ (scroll-conservatively 101)
+ (epg-pinentry-mode 'loopback)
+ (view-read-only t) ;; Enter view mode on read-only files
+ (imenu-auto-rescan t) ;; Automatically update imenu entries based on current buffer/file
+ (minibuffer-visible-completions t) ;; Use arrow keys to select completion candidates
+
+ :hook ;; Add hooks to enable specific features in certain modes.
+ (prog-mode . display-line-numbers-mode) ;; Enable line numbers in programming modes.
+ (text-mode . display-line-numbers-mode)
+
+ :config
+ ;; By default emacs gives you access to a lot of *special* buffers, while navigating with [b and ]b,
+ ;; this might be confusing for newcomers. This settings make sure ]b and [b will always load a
+ ;; file buffer. To see all buffers use <leader> SPC, <leader> b l, or <leader> b i.
+ (defun skip-these-buffers (_window buffer _bury-or-kill)
+ "Function for `switch-to-prev-buffer-skip'."
+ (string-match "\\*[^*]+\\*" (buffer-name buffer)))
+ (setq switch-to-prev-buffer-skip 'skip-these-buffers)
+
+ (set-face-attribute 'default nil :family "Departure Mono" :height 120)
+
+ ;; Save manual customizations to a separate file instead of cluttering `init.el'.
+ ;; You can M-x customize, M-x customize-group, or M-x customize-themes, etc.
+ ;; The saves you do manually using the Emacs interface would overwrite this file.
+ ;; The following makes sure those customizations are in a separate file.
+ (setq custom-file (locate-user-emacs-file "custom-vars.el")) ;; Specify the custom file path.
+ (load custom-file 'noerror 'nomessage) ;; Load the custom file quietly, ignoring errors.
+
+ ;; Makes Emacs vertical divisor the symbol │ instead of |.
+ (set-display-table-slot standard-display-table 'vertical-border (make-glyph-code ?│))
+
+ :init ;; Initialization settings that apply before the package is loaded.
+ (tool-bar-mode -1) ;; Disable the tool bar for a cleaner interface.
+ (menu-bar-mode -1) ;; Disable the menu bar for a more streamlined look.
+
+ (when scroll-bar-mode
+ (scroll-bar-mode -1)) ;; Disable the scroll bar if it is active.
+
+ (global-auto-revert-mode 1) ;; Enable global auto-revert mode to keep buffers up to date with their corresponding files.
+ (recentf-mode 1) ;; Enable tracking of recently opened files.
+
+ (setq history-delete-duplicates t)
+ (savehist-mode 1) ;; Enable saving of command history.
+
+ (save-place-mode 1) ;; Enable saving the place in files for easier return.
+ (winner-mode 1) ;; Enable winner mode to easily undo window configuration changes.
+ (xterm-mouse-mode 1) ;; Enable mouse support in terminal mode.
+ (file-name-shadow-mode 1) ;; Enable shadowing of filenames for clarity.
+
+ (auth-source-pass-enable) ;; Use password-store instead of authinfo
+
+ (midnight-mode 1) ;; Cleanup every 3 days
+
+ ;; Set the default coding system for files to UTF-8.
+ (modify-coding-system-alist 'file "" 'utf-8))
+
+(use-package windmove
+ :ensure nil
+ :init
+ (windmove-default-keybindings 'meta))
+
+(use-package window
+ :ensure nil ;; This is built-in, no need to fetch it.
+ :custom
+ (display-buffer-alist
+ '(
+ ;; ("\\*.*e?shell\\*"
+ ;; (display-buffer-in-side-window)
+ ;; (window-height . 0.25)
+ ;; (side . bottom)
+ ;; (slot . -1))
+
+ ("\\*\\(Backtrace\\|Warnings\\|Compile-Log\\|[Hh]elp\\|Messages\\|Bookmark List\\|Ibuffer\\|Occur\\|eldoc.*\\)\\*"
+ (display-buffer-in-side-window)
+ (window-height . 0.25)
+ (side . bottom)
+ (slot . 0))
+
+ ;; Example configuration for the LSP help buffer,
+ ;; keeps it always on bottom using 25% of the available space:
+ ("\\*\\(lsp-help\\)\\*"
+ (display-buffer-in-side-window)
+ (window-height . 0.25)
+ (side . bottom)
+ (slot . 0))
+
+ ;; Configuration for displaying various diagnostic buffers on
+ ;; bottom 25%:
+ ("\\*\\(Flymake diagnostics\\|xref\\|ivy\\|Swiper\\|Completions\\)"
+ (display-buffer-in-side-window)
+ (window-height . 0.25)
+ (side . bottom)
+ (slot . 1))
+ )))
+
+(use-package ibuffer
+ :ensure nil
+ :bind ([remap list-buffers] . ibuffer))
+
+(use-package dired
+ :ensure nil ;; This is built-in, no need to fetch it.
+ :bind
+ (:map dired-mode-map ("." . dired-omit-mode))
+ :hook
+ (dired-mode . dired-omit-mode)
+ :init
+ (with-eval-after-load 'dired (require 'dired-x))
+ :custom
+ (dired-omit-files "^\\.[a-zA-Z0-9]+")
+ (dired-listing-switches "-lah --group-directories-first") ;; Display files in a human-readable format and group directories first.
+ (dired-guess-shell-alist-user
+ '(("\\.\\(mp[34]\\|m4a\\|ogg\\|flac\\|webm\\|mkv\\)" "mpv --really-quiet" "xdg-open" "open") ;; Open audio and video files with `mpv'.
+ (".*" "open" "xdg-open")))
+ (dired-dwim-target t) ;; Enable "do what I mean" for target directories.
+ (dired-kill-when-opening-new-dired-buffer t) ;; Close the previous buffer when opening a new `dired' instance.
+ (dired-auto-revert-buffer t)
+ (dired-mouse-drag-files t)
+ :config
+ (when (eq system-type 'darwin)
+ (let ((gls (executable-find "gls"))) ;; Use GNU ls on macOS if available.
+ (when gls
+ (setq insert-directory-program gls)))))
+
+(use-package isearch
+ :ensure nil ;; This is built-in, no need to fetch it.
+ :config
+ (setq isearch-lazy-count t) ;; Enable lazy counting to show current match information.
+ (setq lazy-count-prefix-format "(%s/%s) ") ;; Format for displaying current match count.
+ (setq lazy-count-suffix-format nil) ;; Disable suffix formatting for match count.
+ (setq search-whitespace-regexp ".*?") ;; Allow searching across whitespace.
+ :bind (("C-s" . isearch-forward) ;; Bind C-s to forward isearch.
+ ("C-r" . isearch-backward))) ;; Bind C-r to backward isearch.
+
+(use-package dictionary
+ :ensure nil
+ :bind (("C-c L" . dictionary-lookup-definition))
+ :config
+ (setq dictionary-server "dict.org"))
+
+(use-package whitespace
+ :init
+ (dolist (hook '(text-mode-hook))
+ (add-hook hook #'whitespace-mode))
+ (add-hook 'before-save-hook #'whitespace-cleanup)
+ :config
+ (setq whitespace-line-column 80) ;; limit line length
+ (setq whitespace-style '(face tabs empty trailing)))
+
+(use-package eldoc
+ :ensure nil ;; This is built-in, no need to fetch it.
+ :config
+ (setq eldoc-idle-delay 0) ;; Automatically fetch doc help
+ (setq eldoc-echo-area-use-multiline-p nil) ;; We use the "K" floating help instead
+ ;; set to t if you want docs on the echo area
+ (setq eldoc-echo-area-display-truncation-message nil)
+ :init
+ (global-eldoc-mode))
+
+(use-package completion-preview
+ :ensure nil
+ :hook (after-init . global-completion-preview-mode)
+ :bind
+ ( :map completion-preview-active-mode-map
+ ("M-n" . completion-preview-next-candidate)
+ ("M-p" . completion-preview-prev-candidate)
+ ("M-<return>" . completion-preview-insert)
+ ("<tab>" . completion-preview-complete))
+ :custom
+ (completion-preview-minimum-symbol-length 2) ; Show the preview already after two symbol characters
+ (completion-preview-exact-match-only nil) ; If t, only show suggestion if there is only one candidate
+ (completion-preview-idle-delay 0.3) ; If non-nil, wait this many idle seconds before displaying preview
+
+ :config
+ (with-eval-after-load 'org
+ ;; Add Org mode's custom 'self-insert-command' to completion-previews
+ (push 'org-self-insert-command completion-preview-commands)
+ )
+ ;; Disable completion preview in Org tables (Emacs 31+)
+ (defun my/detect-org-table ()
+ "Return true if point in Org table."
+ (and (derived-mode-p 'org-mode) (org-at-table-p)))
+ (add-hook 'completion-preview-inhibit-functions
+ #'my/detect-org-table))
+
+(use-package tramp
+ :ensure nil
+ :commands (sudo-find-file sudo-this-file)
+ :bind ("C-c f s" . sudo-find-file)
+ :config
+ (defun sudo-find-file (file)
+ "Open FILE as root."
+ (interactive "FOpen file as root: ")
+ (when (file-writable-p file)
+ (user-error "File is user writeable, aborting sudo"))
+ (find-file (if (file-remote-p file)
+ (concat "/" (file-remote-p file 'method) ":"
+ (file-remote-p file 'user) "@" (file-remote-p file 'host)
+ "|sudo:root@"
+ (file-remote-p file 'host) ":" (file-remote-p file 'localname))
+ (concat "/sudo:root@localhost:" file))))
+ (defun sudoedit ()
+ "Open the current file as root."
+ (interactive)
+ (sudo-find-file (file-truename buffer-file-name)))
+ (setq remote-file-name-inhibit-locks t
+ remote-file-name-inhibit-auto-save-visited t
+ tramp-copy-size-limit (* 1024 1024))
+ (connection-local-set-profile-variables
+ 'remote-direct-async-process '((tramp-direct-async-process . t)))
+ (connection-local-set-profiles
+ '(:application tramp :protocol "scp") 'remote-direct-async-process)
+ (with-eval-after-load 'compile
+ (remove-hook 'compilation-mode-hook
+ #'tramp-compile-disable-ssh-controlmaster-options)))
+
+(use-package project
+ :ensure nil
+ :config
+ (setq project-vc-extra-root-markers '(".project")))
+
+(use-package proced
+ :ensure nil
+ :custom
+ (proced-auto-update-flag 'visible)
+ (proced-enable-color-flag t))
+
+(use-package flyspell
+ :disabled ;; TODO: Remove on Emacs 31
+ :ensure nil
+ :config
+ (flyspell-delay-use-timer t)
+ :hook
+ (text-mode . flyspell-mode)
+ (prog-mode . flyspell-prog-mode))
+
+(use-package hippie-exp
+ :ensure nil
+ :bind ([remap dabbrev-expand] . hippie-expand))
+
+(provide 'emacs-config)
diff --git a/dot_config/emacs/lisp/email-config.el b/dot_config/emacs/lisp/email-config.el
new file mode 100644
index 0000000..23ad16f
--- /dev/null
+++ b/dot_config/emacs/lisp/email-config.el
@@ -0,0 +1,3 @@
+(use-package notmuch)
+
+(provide 'email-config)
diff --git a/dot_config/emacs/lisp/embark-config.el b/dot_config/emacs/lisp/embark-config.el
new file mode 100644
index 0000000..5d39e9d
--- /dev/null
+++ b/dot_config/emacs/lisp/embark-config.el
@@ -0,0 +1,11 @@
+(use-package embark
+ :ensure t
+ :bind
+ (("C-." . embark-act) ;; Pick a target and choose an action
+ ("M-." . embark-dwim))) ;; "Do What I Mean" default action
+
+(use-package embark-consult
+ :ensure t
+ :after (embark consult))
+
+(provide 'embark-config)
diff --git a/dot_config/emacs/lisp/evil-config.el b/dot_config/emacs/lisp/evil-config.el
new file mode 100644
index 0000000..0be0cc6
--- /dev/null
+++ b/dot_config/emacs/lisp/evil-config.el
@@ -0,0 +1,132 @@
+;; EVIL
+;; The `evil' package provides Vim emulation within Emacs, allowing
+;; users to edit text in a modal way, similar to how Vim
+;; operates. This setup configures `evil-mode' to enhance the editing
+;; experience.
+(use-package evil
+ :straight t
+ :ensure t
+ :defer t
+ :hook
+ (after-init . evil-mode)
+ :init
+ (setq evil-want-integration t) ;; Integrate `evil' with other Emacs features (optional as it's true by default).
+ (setq evil-want-keybinding nil) ;; Disable default keybinding to set custom ones.
+ (setq evil-want-C-u-scroll t) ;; Makes C-u scroll
+ (setq evil-want-C-u-delete t) ;; Makes C-u delete on insert mode
+ :config
+ (setq evil-want-fine-undo t) ;; Evil uses finer grain undoing steps
+
+ ;; Keybindings for searching and finding files.
+ (evil-define-key 'normal 'global (kbd "C-c s f") 'consult-find)
+ (evil-define-key 'normal 'global (kbd "C-c s g") 'consult-grep)
+ (evil-define-key 'normal 'global (kbd "C-c s G") 'consult-git-grep)
+ (evil-define-key 'normal 'global (kbd "C-c s r") 'consult-ripgrep)
+ (evil-define-key 'normal 'global (kbd "C-c s h") 'consult-info)
+ (evil-define-key 'normal 'global (kbd "C-c /") 'consult-line)
+
+ ;; Flymake navigation
+ (evil-define-key 'normal 'global (kbd "C-c x x") 'consult-flymake);; Gives you something like `trouble.nvim'
+ (evil-define-key 'normal 'global (kbd "] d") 'flymake-goto-next-error) ;; Go to next Flymake error
+ (evil-define-key 'normal 'global (kbd "[ d") 'flymake-goto-prev-error) ;; Go to previous Flymake error
+
+ ;; Diff-HL navigation for version control
+ (evil-define-key 'normal 'global (kbd "] c") 'diff-hl-next-hunk) ;; Next diff hunk
+ (evil-define-key 'normal 'global (kbd "[ c") 'diff-hl-previous-hunk) ;; Previous diff hunk
+
+ ;; Magit keybindings for Git integration
+ (evil-define-key 'normal 'global (kbd "C-c g g") 'magit-status) ;; Open Magit status
+ (evil-define-key 'normal 'global (kbd "C-c g l") 'magit-log-current) ;; Show current log
+ (evil-define-key 'normal 'global (kbd "C-c g d") 'magit-diff-buffer-file) ;; Show diff for the current file
+ (evil-define-key 'normal 'global (kbd "C-c g D") 'diff-hl-show-hunk) ;; Show diff for a hunk
+ (evil-define-key 'normal 'global (kbd "C-c g b") 'vc-annotate) ;; Annotate buffer with version control info
+
+ ;; Buffer management keybindings
+ (evil-define-key 'normal 'global (kbd "] b") 'switch-to-next-buffer) ;; Switch to next buffer
+ (evil-define-key 'normal 'global (kbd "[ b") 'switch-to-prev-buffer) ;; Switch to previous buffer
+ (evil-define-key 'normal 'global (kbd "C-c b i") 'consult-buffer) ;; Open consult buffer list
+ (evil-define-key 'normal 'global (kbd "C