863 lines
26 KiB
EmacsLisp
863 lines
26 KiB
EmacsLisp
;;; mitch-packages --- Declare and configure use-package statements
|
|
|
|
;;; Commentary:
|
|
;; -----------------------------------------------------------------------------
|
|
;; This is a file in which I put declarations for packages and things.
|
|
;; -----------------------------------------------------------------------------
|
|
;;; Code:
|
|
|
|
;; diminish
|
|
(use-package diminish)
|
|
(use-package eldoc
|
|
:straight (:type built-in)
|
|
:diminish
|
|
:defer 1
|
|
:custom (eldoc-echo-area-use-multiline-p nil))
|
|
|
|
;; save minibuffer history, see Vertico below
|
|
(use-package savehist
|
|
:straight (:type built-in)
|
|
:init (savehist-mode)
|
|
:custom (savehist-file
|
|
(expand-file-name "minibuffer-history" backup-directory)))
|
|
|
|
;; save place in all files
|
|
(use-package saveplace
|
|
:straight (:type built-in)
|
|
:init (save-place-mode t)
|
|
:custom
|
|
(save-place-file
|
|
(expand-file-name "file-position-save" backup-directory)))
|
|
(use-package tramp
|
|
:straight (:type built-in)
|
|
:custom (tramp-persistency-file-name
|
|
(expand-file-name "tramp-history" backup-directory)))
|
|
;; Visualize whitespace. In a very chill and invisible way.
|
|
(use-package whitespace
|
|
:straight (:type built-in)
|
|
:diminish (whitespace-mode org-indent-mode org-vw-mode auto-fill-mode)
|
|
:custom
|
|
(whitespace-style '(face lines-tail))
|
|
(whitespace-line-column 80)
|
|
(fill-column 80)
|
|
:hook
|
|
(prog-mode . whitespace-mode)
|
|
(org-mode . auto-fill-mode))
|
|
(use-package image-mode
|
|
:straight (:type built-in)
|
|
:config
|
|
(turn-off-line-numbers)
|
|
(blink-cursor-mode -1))
|
|
|
|
;; ...and finally, sync files with disk changes
|
|
(use-package autorevert
|
|
:straight (:type built-in)
|
|
:diminish auto-revert-mode
|
|
:config (global-auto-revert-mode))
|
|
|
|
;; Keybinding manager
|
|
(use-package general
|
|
:straight t
|
|
:config (mitch/general-config))
|
|
|
|
(use-package use-package-ensure-system-package)
|
|
|
|
;; load evil
|
|
(use-package evil
|
|
:general
|
|
;; Visual lines. Redefined for auto-scrolling madness.
|
|
(general-define-key
|
|
:states 'normal
|
|
"<escape>" 'evil-beginning-of-line
|
|
"j" 'evil-next-visual-line
|
|
"k" 'evil-previous-visual-line
|
|
"C-n" 'move-screen-up-line
|
|
"C-p" 'move-screen-down-line)
|
|
(general-define-key
|
|
:states 'insert
|
|
"C-w" 'evil-window-map
|
|
"C-V" (general-key-dispatch
|
|
'evil-quoted-insert
|
|
"u" 'insert-char))
|
|
:diminish visual-line-mode
|
|
:custom
|
|
(evil-want-integration t)
|
|
(evil-want-keybinding nil)
|
|
(evil-want-C-u-scroll nil)
|
|
(evil-want-C-i-jump nil)
|
|
(evil-vsplit-window-right t)
|
|
(evil-split-window-below t)
|
|
(evil-undo-system
|
|
(if (>= (string-to-number emacs-version) 28)
|
|
(quote undo-redo)
|
|
(quote undo-fu)))
|
|
:init (evil-mode t)
|
|
:config (mitch/evil-config))
|
|
(use-package evil-collection
|
|
:straight t
|
|
:after evil
|
|
:diminish evil-collection-unimpaired-mode
|
|
:config (evil-collection-init))
|
|
(use-package evil-commentary
|
|
:straight t
|
|
:diminish 'evil-commentary-mode
|
|
:config (evil-commentary-mode)
|
|
:hook (prog-mode . evil-commentary-mode))
|
|
(use-package evil-surround
|
|
:straight t
|
|
:diminish 'global-evil-surround-mode
|
|
:hook (prog-mode . evil-surround-mode)
|
|
:config (global-evil-surround-mode 1))
|
|
(use-package evil-matchit
|
|
:straight t
|
|
:diminish 'evil-matchit-mode
|
|
:config (global-evil-matchit-mode 1))
|
|
(use-package evil-terminal-cursor-changer
|
|
:straight t
|
|
:after evil
|
|
:diminish
|
|
:if (not (display-graphic-p))
|
|
:custom
|
|
(evil-motion-state-cursor 'box) ; █
|
|
(evil-visual-state-cursor 'box) ; █
|
|
(evil-normal-state-cursor 'box) ; █
|
|
(evil-insert-state-cursor 'bar) ; ⎸
|
|
(evil-emacs-state-cursor 'hbar) ; _
|
|
:config
|
|
(evil-terminal-cursor-changer-activate)
|
|
(xterm-mouse-mode))
|
|
(use-package undo-fu
|
|
:after evil
|
|
:if (< (string-to-number emacs-version) 28)
|
|
:diminish)
|
|
(use-package altcaps
|
|
:straight (:type git :host github :repo "protesilaos/altcaps")
|
|
:general (general-define-key
|
|
:states 'visual
|
|
"`" 'altcaps-region))
|
|
|
|
;; eshell. Pretty good actually.
|
|
(use-package eshell
|
|
:straight (:type built-in)
|
|
:commands (eshell/emacs eshell/man)
|
|
:custom
|
|
(eshell-scroll-to-bottom-on-input t)
|
|
(eshell-hist-ignoredups t)
|
|
:config
|
|
(add-to-list 'eshell-modules-list 'eshell-rebind)
|
|
(defun eshell-evil-insert-line (count &optional vcount)
|
|
(interactive "p")
|
|
(eshell-bol)
|
|
(evil-insert count vcount))
|
|
(defun eshell/emacs (&rest args)
|
|
"Basically you can edit ARGS and it will open in a new buffer.
|
|
When your shell is Emacs, your Emacs is but an oyster...
|
|
This is taken from a website that I can't remember at the moment."
|
|
(if (null args) (bury-buffer)
|
|
(mapc #'find-file-other-window
|
|
(mapcar #'expand-file-name (flatten-tree (reverse args))))))
|
|
(defun aweshell-sudo-toggle ()
|
|
"Toggle sudo with current command."
|
|
(interactive)
|
|
(save-excursion
|
|
(let ((commands (buffer-substring-no-properties
|
|
(progn (eshell-bol) (point)) (point-max))))
|
|
(if (string-match-p "^sudo " commands)
|
|
(progn
|
|
(eshell-bol)
|
|
(while (re-search-forward "sudo " nil t)
|
|
(replace-match "" t nil)))
|
|
(progn
|
|
(eshell-bol)
|
|
(insert "sudo ")))))))
|
|
(use-package eat
|
|
:straight (:repo "https://codeberg.org/akib/emacs-eat"
|
|
:files ("*.el" "dir" "*.info" "*.texi" "*.ti" ("e" "e/*")))
|
|
:hook (eshell-mode . eat-eshell-visual-command-mode))
|
|
;; (use-package eshell-vterm
|
|
;; :after eshell
|
|
;; :custom (eshell-destroy-buffer-when-process-dies t)
|
|
;; :hook (eshell-mode . eshell-vterm-mode))
|
|
(use-package eshell-syntax-highlighting
|
|
:after eshell
|
|
:hook (eshell-mode . eshell-syntax-highlighting-mode))
|
|
(use-package eshell-dat
|
|
:straight (:type git :repo "https://git.mitchmarq42.xyz/mitch/eshell-dat"))
|
|
(use-package eshell-prompt-extras
|
|
:after eshell
|
|
:custom
|
|
(eshell-highlight-prompt nil)
|
|
(eshell-prompt-function 'epe-theme-multiline-with-status)
|
|
(epe-path-style 'full))
|
|
|
|
(use-package all-the-icons)
|
|
(use-package dirvish
|
|
:straight (:files (:defaults "extensions/*.el"))
|
|
:defer 0.5
|
|
:commands dirvish
|
|
:custom
|
|
(dirvish-attributes '(all-the-icons collapse))
|
|
(dirvish-cache-dir (expand-file-name ".dirvish/" user-emacs-directory))
|
|
(dired-listing-switches "-l --almost-all")
|
|
(dirvish-side-display-alist '((window-width . 0.15)
|
|
(slot . -1)
|
|
(side . left)))
|
|
:init (dirvish-override-dired-mode t)
|
|
:config
|
|
(general-define-key
|
|
:states 'normal
|
|
:keymaps 'dirvish-mode-map
|
|
"h" 'dired-up-directory
|
|
"l" 'dired-find-file
|
|
"/" 'dirvish-narrow
|
|
"q" 'dirvish-quit)
|
|
(general-define-key
|
|
:states 'normal
|
|
:prefix-command 'file-tree-map-prefix
|
|
:prefix-map 'file-tree-map
|
|
:prefix "SPC t"
|
|
"t" 'dirvish-side))
|
|
|
|
;; Completion framework...
|
|
(use-package vertico
|
|
:straight (:files (:defaults "extensions/vertico-mouse.el"))
|
|
:custom (vertico-resize t)
|
|
:init (vertico-mode t)
|
|
:config
|
|
(add-hook 'minibuffer-setup-hook 'turn-off-line-numbers)
|
|
(defun backspace-in-minibuffer ()
|
|
"If previous character is `/', kill to the previous `/'.
|
|
Otherwise, kill back 1 letter.
|
|
|
|
see https://www.reddit.com/r/emacs/comments/xq6rpa/comment/iqynyu9/?utm_source=share&utm_medium=web2x&context=3"
|
|
(interactive)
|
|
(if (string-match-p "/." (minibuffer-contents))
|
|
(let ((end (point)))
|
|
(re-search-backward "/.")
|
|
(forward-char)
|
|
(delete-region (point) end))
|
|
(backward-delete-char 1)))
|
|
:general
|
|
(general-define-key
|
|
:prefix-map 'minibuffer-mode-map
|
|
"DEL" 'backspace-in-minibuffer))
|
|
(use-package vertico-mouse
|
|
:straight vertico
|
|
:after vertico
|
|
:config
|
|
(vertico-mouse-mode))
|
|
(use-package consult
|
|
:after vertico
|
|
:general
|
|
(general-define-key
|
|
[remap switch-to-buffer] 'consult-buffer))
|
|
;; Minibuffer generic stuff
|
|
(use-package marginalia
|
|
;; :custom (marginalia-separator " ")
|
|
:init (marginalia-mode))
|
|
(use-package orderless
|
|
:custom
|
|
(completion-styles '(orderless partial-completion basic))
|
|
(completion-category-defaults nil)
|
|
;; (completion-category-overrides '((file (styles basic partial-completion))))
|
|
(completion-category-overrides nil))
|
|
|
|
;; weird multi-path thing
|
|
(use-package embark
|
|
:general
|
|
(general-define-key
|
|
:keymap minibuffer-mode-map
|
|
"C-." 'embark-act ; broken by default on gnome. Run `ibus-setup' -> emoji
|
|
"C-;" 'embark-dwim)
|
|
:init
|
|
;; :TODO: Should we put this in the which-key section?
|
|
(defun embark-which-key-indicator ()
|
|
"An embark indicator that displays keymaps using which-key.
|
|
The which-key help message will show the type and value of the
|
|
current target followed by an ellipsis if there are further
|
|
targets."
|
|
(lambda (&optional keymap targets prefix)
|
|
(if (null keymap) (which-key--hide-popup-ignore-command)
|
|
(which-key--show-keymap
|
|
(if (eq (plist-get (car targets) :type) 'embark-become)
|
|
"Become"
|
|
(format "Act on %s '%s'%s" (plist-get (car targets) :type)
|
|
(embark--truncate-target (plist-get (car targets) :target))
|
|
(if (cdr targets) "…" "")))
|
|
(if prefix (pcase (lookup-key keymap prefix 'accept-default)
|
|
((and (pred keymapp) km) km)
|
|
(_ (key-binding prefix 'accept-default))) keymap)
|
|
nil nil t (lambda (binding)
|
|
(not (string-suffix-p "-argument" (cdr binding))))))))
|
|
(setq embark-indicators
|
|
'(embark-which-key-indicator
|
|
embark-highlight-indicator
|
|
embark-isearch-highlight-indicator))
|
|
(defun embark-hide-which-key-indicator (fn &rest args)
|
|
"Hide the which-key indicator immediately when using the completing-read prompter."
|
|
(which-key--hide-popup-ignore-command)
|
|
(let ((embark-indicators
|
|
(remq #'embark-which-key-indicator embark-indicators)))
|
|
(apply fn args)))
|
|
(advice-add #'embark-completing-read-prompter
|
|
:around #'embark-hide-which-key-indicator)
|
|
:custom (enable-recursive-minibuffers t))
|
|
;; Consult users will also want the embark-consult package.
|
|
(use-package embark-consult
|
|
:after (embark consult))
|
|
|
|
;; SORTA WORKING: Relative line numbers with stuff
|
|
(use-package nlinum-relative
|
|
:custom
|
|
(nlinum-relative-redisplay-delay 0)
|
|
:hook (prog-mode . nlinum-relative-mode)
|
|
:init
|
|
(defun mitch/nlinum-buffer-setup ()
|
|
(setq nlinum-format-function
|
|
(lambda (line width)
|
|
(let* ((line-display (abs (- line nlinum-relative--current-line)))
|
|
(is-current-line? (eq line-display 0))
|
|
(line-display (if is-current-line?
|
|
nlinum-relative--current-line
|
|
(+ nlinum-relative-offset line-display)))
|
|
(numwidth (length (number-to-string line-display)))
|
|
(spaces (make-string (- width numwidth) ?\ ))
|
|
(nlinum-format (if is-current-line?
|
|
(format "%%d%s" spaces)
|
|
(format "%s%%d" spaces)))
|
|
(str (if (and (not (string-equal
|
|
nlinum-relative-current-symbol ""))
|
|
is-current-line?)
|
|
nlinum-relative-current-symbol
|
|
(format nlinum-format line-display))))
|
|
(if is-current-line?
|
|
(put-text-property
|
|
0 width 'face 'nlinum-relative-current-face str)
|
|
(put-text-property 0 width 'face 'linum str))
|
|
str)))
|
|
(setq-local nlinum--width (length (number-to-string
|
|
(line-number-at-pos (point-max))))))
|
|
(add-hook 'prog-mode-hook #'mitch/nlinum-buffer-setup))
|
|
|
|
;; broken terminal that doesn't compile but at least it's fast when it does
|
|
(use-package vterm
|
|
:custom
|
|
(vterm-always-compile-module t)
|
|
(vterm-module-cmake-args "-DUSE_SYSTEM_LIBVTERM=no")
|
|
(vterm-clear-scrollback-when-clearing t)
|
|
:config
|
|
(evil-collection-define-key 'insert 'vterm-mode-map
|
|
(kbd "C-w") 'evil-window-map)
|
|
(evil-collection-define-key 'normal 'vterm-mode-map
|
|
(kbd "RET") 'hkey-either
|
|
(kbd "k") 'vterm-send-up
|
|
(kbd "j") 'vterm-send-down)
|
|
(add-to-list 'vterm-keymap-exceptions
|
|
"C-w")
|
|
(add-to-list 'vterm-keymap-exceptions
|
|
"RET")
|
|
(setq mitch/vterm-eval-cmds-strings
|
|
'("update-pwd"
|
|
"restart-emacs"
|
|
"find-file-other-window"
|
|
"find-file-other-frame"
|
|
"eshell/emacs"
|
|
"eshell/man"
|
|
"dirvish"
|
|
"magit"
|
|
"info-other-window"
|
|
"add-vterm-eval-cmd"))
|
|
(defun add-vterm-eval-cmd (function)
|
|
"Add FUNCTION to `vterm-eval-cmds' so it can be ran through sh in vterm."
|
|
(add-to-list 'vterm-eval-cmds
|
|
(list function (intern function))))
|
|
(dolist (emacs-function mitch/vterm-eval-cmds-strings)
|
|
(add-vterm-eval-cmd emacs-function))
|
|
:hook
|
|
(vterm-mode . mitch/terminal-setup)
|
|
(vterm-exit-functions . save-buffers-kill-terminal))
|
|
(use-package multi-vterm
|
|
:commands (multi-vterm multi-vterm-other-window)
|
|
:config
|
|
(defun multi-vterm-other-window ()
|
|
"Run a new-ish vterm in the other window"
|
|
(interactive)
|
|
(other-window 1) (multi-vterm))
|
|
:general
|
|
(general-define-key
|
|
:states '(normal visual)
|
|
:prefix "SPC"
|
|
:non-normal-prefix "SPC"
|
|
"v" 'multi-vterm)
|
|
(general-define-key
|
|
:states 'normal
|
|
:prefix-map 'ctl-x-4-map
|
|
:prefix "SPC 4"
|
|
"v" 'multi-vterm-other-window))
|
|
|
|
;; Better modeline? Better modeline.
|
|
(use-package powerline
|
|
:custom
|
|
(powerline-display-buffer-size nil)
|
|
(powerline-default-separator 'utf-8)
|
|
(powerline-utf-8-separator-left (string-to-char ""))
|
|
(powerline-utf-8-separator-right (string-to-char "")))
|
|
(use-package airline-themes
|
|
:custom
|
|
(airline-cursor-colors nil)
|
|
(airline-display-directory t)
|
|
(airline-eshell-colors nil)
|
|
(airline-shortened-directory-length 20)
|
|
:config (load-theme 'airline-kolor))
|
|
;; see https://github.com/dbordak/telephone-line/issues/126
|
|
;; (no telephone-line because why)
|
|
|
|
;; Custom Theme.
|
|
;; Not to be confused with a color theme, or a color scheme, or a custom scheme.
|
|
(use-package mitch-theme
|
|
:straight (:type git :repo
|
|
"https://git.mitchmarq42.xyz/mitch/vimcolors"
|
|
:files (:defaults "mitch-theme.el"))
|
|
:config (mitch/visual-setup)
|
|
:init (load-theme 'mitch t))
|
|
|
|
(use-package yascroll
|
|
:diminish
|
|
:defer 1
|
|
;; :if (not (display-graphic-p))
|
|
:custom (yascroll:delay-to-hide nil)
|
|
:custom-face
|
|
(yascroll:thumb-fringe
|
|
((t (:background "green3"))))
|
|
:config
|
|
(defun yascroll:make-thumb-overlay-fringe (left-or-right)
|
|
"Make thumb overlay on the LEFT-OR-RIGHT fringe."
|
|
(let* ((pos (point))
|
|
;; If `pos' is at the beginning of line, overlay of the
|
|
;; fringe will be on the previous visual line.
|
|
(pos (if (= (line-end-position) pos) pos (1+ pos)))
|
|
;; below originally said `filled-rectangle' instead of `empty-line'.
|
|
;; Changed to fix transparency.
|
|
(display-string `(,left-or-right empty-line yascroll:thumb-fringe))
|
|
(after-string (propertize "." 'display display-string))
|
|
(overlay (make-overlay pos pos)))
|
|
(overlay-put overlay 'after-string after-string)
|
|
(overlay-put overlay 'fringe-helper t)
|
|
(overlay-put overlay 'window (selected-window))
|
|
(overlay-put overlay 'priority yascroll:priority)
|
|
overlay))
|
|
(global-yascroll-bar-mode 1))
|
|
|
|
;; parentheses settingses
|
|
(use-package paredit
|
|
:diminish
|
|
:general (general-define-key
|
|
"M-j" 'paredit-forward-slurp-sexp
|
|
"M-k" 'paredit-forward-barf-sexp
|
|
"M-h" 'paredit-backward-barf-sexp
|
|
"M-l" 'paredit-backward-slurp-sexp)
|
|
:hook (prog-mode . paredit-mode)
|
|
:init
|
|
(show-paren-mode 1)
|
|
(paredit-mode 1)
|
|
(electric-pair-mode 1)
|
|
:custom
|
|
(show-paren-delay 0)
|
|
(show-paren-style 'parenthesis))
|
|
(use-package evil-paredit
|
|
:after paredit
|
|
:hook (evil-mode . evil-paredit-mode))
|
|
|
|
;; org mode and messy things
|
|
(use-package org
|
|
:straight (:type built-in)
|
|
:diminish (org-indent-mode org-vw-mode)
|
|
:custom
|
|
(org-hide-leading-stars t)
|
|
(org-startup-indented t)
|
|
(org-hide-emphasis-markers t)
|
|
:config
|
|
(add-hook 'after-save-hook
|
|
#'(lambda () (if (equal major-mode 'org-mode)
|
|
(org-babel-tangle))))
|
|
(defvar org-electric-pairs '((?_ . ?_)
|
|
(?/ . ?/)
|
|
(?* . ?*)
|
|
(?+ . ?+)
|
|
(?~ . ?~)
|
|
(?= . ?=))
|
|
"Electric pairs for org-mode.
|
|
|
|
See https://emacs.stackexchange.com/questions/2538/how-to-define-additional-mode-specific-pairs-for-electric-pair-mode")
|
|
(defun org-add-electric-pairs ()
|
|
(setq-local electric-pair-pairs (append electric-pair-pairs org-electric-pairs))
|
|
(setq-local electric-pair-text-pairs electric-pair-pairs))
|
|
(add-hook 'org-mode-hook 'org-add-electric-pairs)
|
|
(require 'mitch-orgstuff)
|
|
(defun insert-zws ()
|
|
(interactive)
|
|
(insert 8203)) ; this is a Zero Width Space. It makes things confusing.
|
|
:hook
|
|
(org-mode . turn-off-line-numbers)
|
|
(org-mode . org-vw-mode)
|
|
:general (general-define-key
|
|
:states 'insert
|
|
:maps 'org-mode-map
|
|
"SPC" (general-key-dispatch 'self-insert-command
|
|
:timeout 0.1
|
|
"`" 'insert-zws)))
|
|
(use-package darkroom
|
|
:hook (org-mode . darkroom-tentative-mode))
|
|
(use-package org-tempo
|
|
:straight (:type built-in)
|
|
:after org
|
|
:config
|
|
(add-to-list 'org-structure-template-alist '("sh" . "src shell"))
|
|
(add-to-list 'org-structure-template-alist '("el" . "src elisp"))
|
|
(add-to-list 'org-structure-template-alist '("html" . "src html")))
|
|
(use-package org-variable-pitch
|
|
:after org
|
|
:if (display-graphic-p)
|
|
:diminish (buffer-face-mode org-variable-pitch-minor-mode)
|
|
:custom-face (org-meta-line
|
|
((nil (:inherit
|
|
(font-lock-comment-delimiter-face fixed-pitch)))))
|
|
:hook (org-mode . org-variable-pitch-minor-mode))
|
|
(use-package org-appear
|
|
:hook (org-mode . org-appear-mode)
|
|
:after org
|
|
:custom
|
|
(org-appear-autolinks t)
|
|
(org-appear-autoemphasis t)
|
|
(org-appear-autoentities t)
|
|
(org-appear-autokeywords t)
|
|
(org-appear-autosubmarkers t))
|
|
(use-package org-pretty-table
|
|
:straight (:type git
|
|
:host github
|
|
:repo "Fuco1/org-pretty-table")
|
|
:diminish
|
|
:hook (org-mode . org-pretty-table-mode))
|
|
(use-package ox-hugo
|
|
:after org
|
|
:config
|
|
(defun hugo-dir-above (dir)
|
|
"Return path of Hugo project root above or at DIR.
|
|
Return nil if DIR is not in a hugo project at all."
|
|
(if (eq dir nil) nil
|
|
(if (file-exists-p (expand-file-name "config.toml" dir)) dir
|
|
(hugo-dir-above (file-name-directory (string-trim-right dir "/"))))))
|
|
(defun hugo-compile (dir)
|
|
(let ((hugo-dir (hugo-dir-above dir)))
|
|
(if hugo-dir
|
|
(if (string-match-p default-directory "/content-org$")
|
|
(org-hugo-export-wim-to-md-after-save)
|
|
(let* ((default-directory hugo-dir)
|
|
(buffer (get-buffer-create "*hugo*")))
|
|
(with-current-buffer buffer
|
|
(compilation-mode)
|
|
(if (zerop (let ((inhibit-read-only t))
|
|
(call-process "sh" nil buffer t "-c" "hugo")))
|
|
(message "Hugo re-generated!")
|
|
(error "Hugo Failed, better change something!"))))))))
|
|
(add-hook 'after-save-hook
|
|
(lambda () (hugo-compile default-directory))))
|
|
|
|
;; fake indentation, other than the other fake indentation
|
|
(use-package adaptive-wrap
|
|
:custom (adaptive-wrap-extra-indent 2)
|
|
:hook (org-mode . adaptive-wrap-prefix-mode))
|
|
|
|
;; cheaty key popups
|
|
(use-package which-key
|
|
:diminish
|
|
:defer 5
|
|
:custom (which-key-idle-delay 2.5)
|
|
:init (which-key-mode t))
|
|
|
|
;; parentheses are boring
|
|
(use-package rainbow-delimiters
|
|
:diminish
|
|
:defer 1
|
|
:hook (prog-mode . rainbow-delimiters-mode))
|
|
|
|
;; Hex colors
|
|
(use-package rainbow-mode
|
|
:diminish
|
|
:hook (prog-mode . rainbow-mode))
|
|
|
|
;; Nobody loves a good language
|
|
(use-package powershell
|
|
:mode ("\\.ps1\\'" . powershell-mode))
|
|
|
|
;; or an okay language
|
|
(use-package cider
|
|
:defer 1)
|
|
|
|
;; c sharp; taken from https://www.reddit.com/r/emacs/comments/k8tnzg/help_setting_up_c_lsp_omnisharproslyn/
|
|
;; (there is nothing here because I'm not using c sharp...)
|
|
|
|
(use-package lsp-mode
|
|
:hook ((powershell-mode . lsp-mode)
|
|
(lsp-mode . lsp-enable-which-key-integration))
|
|
:commands lsp
|
|
:diminish lsp-lens-mode
|
|
:custom (lsp-completion-provider :none))
|
|
|
|
;; broken snippets I don't care about...
|
|
(use-package yasnippet
|
|
:diminish yas-minor-mode
|
|
:hook (prog-mode . yas-minor-mode))
|
|
(use-package yasnippet-snippets)
|
|
|
|
;; Better help-pages. Genuinely pretty great.
|
|
(use-package helpful
|
|
:general (general-define-key
|
|
[remap describe-key] 'helpful-key
|
|
[remap describe-variable] 'helpful-variable
|
|
[remap describe-function] 'helpful-callable)
|
|
(general-define-key
|
|
:keymaps 'help-map
|
|
"F" 'describe-face
|
|
"k" 'helpful-key)
|
|
(general-define-key
|
|
:keymaps 'emacs-lisp-mode-map
|
|
:states 'normal
|
|
"K" 'helpful-at-point)
|
|
:custom (elisp-refs-verbose nil))
|
|
|
|
;; Better lisp highlighting?
|
|
(use-package highlight-defined
|
|
:hook (emacs-lisp-mode . highlight-defined-mode))
|
|
(use-package relint)
|
|
|
|
;; Shell linting?
|
|
(use-package flymake
|
|
:diminish
|
|
:hook (prog-mode . flymake-mode))
|
|
|
|
;; Emacs startup profiling -- may not work with chemacs2
|
|
(use-package esup
|
|
:commands esup)
|
|
|
|
;; Blingy laggy minimap on the right
|
|
(use-package minimap
|
|
:general (general-define-key
|
|
:states 'normal
|
|
:prefix-command 'mini-map-prefix
|
|
:prefix-map 'mini-map
|
|
:prefix "SPC m"
|
|
"m" 'minimap-mode
|
|
"k" 'minimap-kill)
|
|
:custom
|
|
(minimap-window-location 'right)
|
|
(minimap-update-delay 0)
|
|
:custom-face
|
|
(minimap-active-region-background
|
|
((t (:background "#303030" :extend t))))
|
|
(minimap-current-line-face
|
|
((nil (:background "#afafaf" :extend t)))))
|
|
|
|
;; epic drop-down completion
|
|
;; (use-package company
|
|
;; :diminish
|
|
;; :custom ;(company-require-match nil)
|
|
;; (company-tooltip-align-annotations t)
|
|
;; :hook (prog-mode . company-mode))
|
|
;; (use-package company-lsp
|
|
;; :after (lsp company)
|
|
;; :config
|
|
;; (push 'company-lsp company-backends))
|
|
;; (use-package company-fuzzy
|
|
;; :diminish
|
|
;; :hook (company-mode . company-fuzzy-mode)
|
|
;; ;; :init
|
|
;; :custom
|
|
;; ;; (company-fuzzy-sorting-backend 'flx)
|
|
;; (company-fuzzy-prefix-on-top nil)
|
|
;; (company-fuzzy-history-backends '(company-yasnippet))
|
|
;; (company-fuzzy-trigger-symbols '("." "->" "<" "\"" "'" "@"))
|
|
;; (company-fuzzy-passthrough-backends '(company-capf)))
|
|
(use-package bash-completion
|
|
:after eshell
|
|
:config
|
|
(defun bash-completion-from-eshell ()
|
|
(interactive)
|
|
(let ((completion-at-point-functions '(bash-completion-eshell-capf)))
|
|
(completion-at-point)))
|
|
(defun bash-completion-eshell-capf ()
|
|
(bash-completion-dynamic-complete-nocomint
|
|
(save-excursion (eshell-bol) (point)) (point) t))
|
|
:general (general-define-key
|
|
:states 'insert
|
|
:maps 'eshell-mode-map
|
|
"TAB" 'bash-completion-from-eshell))
|
|
(use-package corfu
|
|
:custom
|
|
(completion-cycle-threshold 3)
|
|
(tab-always-indent 'complete)
|
|
(corfu-auto t)
|
|
(corfu-quit-no-match t)
|
|
(corfu-count (- (window-total-height) 10))
|
|
;; (corfu-separator ";")
|
|
:init (global-corfu-mode)
|
|
;; (defun corfu-enable-always-in-minibuffer ()
|
|
;; "Enable Corfu in the minibuffer if Vertico/Mct are not active."
|
|
;; (unless (or (bound-and-true-p mct--active)
|
|
;; (bound-and-true-p vertico--input))
|
|
;; (setq-local corfu-auto nil) ;; Enable/disable auto completion
|
|
;; (corfu-mode 1)
|
|
;; (minibuffer-complete)))
|
|
;; (add-hook 'minibuffer-setup-hook #'corfu-enable-always-in-minibuffer 1)
|
|
;; (defun corfu-kill-in-minibuffer ()
|
|
;; "Kill corfu and minibuffer. To be bound to Esc."
|
|
;; (interactive)
|
|
;; (setq-local inhibit-debugger t)
|
|
;; (corfu-quit)
|
|
;; (exit-minibuffer)
|
|
;; )
|
|
(defun corfu-send-shell (&rest _)
|
|
"Send completion candidate when inside comint/eshell."
|
|
(cond
|
|
((and (derived-mode-p 'eshell-mode) (fboundp 'eshell-send-input))
|
|
(eshell-send-input))
|
|
((and (derived-mode-p 'comint-mode) (fboundp 'comint-send-input))
|
|
(comint-send-input))))
|
|
:general
|
|
(general-define-key
|
|
:prefix-map 'corfu-map
|
|
"C-n" 'corfu-next
|
|
"C-p" 'corfu-previous
|
|
"RET" 'corfu-insert
|
|
"ESC" 'corfu-quit))
|
|
|
|
(use-package popon
|
|
:straight
|
|
(:type git
|
|
:repo "https://codeberg.org/akib/emacs-popon")
|
|
:if (not (display-graphic-p)))
|
|
(use-package corfu-terminal
|
|
:straight
|
|
(:type git
|
|
:repo "https://codeberg.org/akib/emacs-corfu-terminal")
|
|
:after popon
|
|
:init (unless
|
|
(display-graphic-p)
|
|
(corfu-terminal-mode +1)))
|
|
|
|
(use-package magit
|
|
:commands (madots magit-status magit)
|
|
:hook (magit-mode . turn-off-line-numbers)
|
|
:config
|
|
(defun madots--magit-buffers-p ()
|
|
(not (not ; converts all non-nil values to t
|
|
(remove nil ; clean useless elements
|
|
(mapcar (lambda (buffer)
|
|
(if (string-match-p "magit: " (buffer-name buffer))
|
|
buffer))
|
|
(buffer-list))))))
|
|
(defun madots--cleanup ()
|
|
"Remove modifications made for `madots' once all magit buffers are killed."
|
|
(if (not (madots--magit-buffers-p))
|
|
(progn
|
|
(setq magit-git-executable madots--old-magit-exe)
|
|
(cancel-function-timers #'madots--cleanup))))
|
|
(defun madots (&optional exe)
|
|
"Magit but with custom EXE, default \"dots\"."
|
|
(interactive)
|
|
(require 'magit)
|
|
(setq madots--old-magit-exe magit-git-executable)
|
|
(setq magit-git-executable (or exe "dots"))
|
|
(magit-status)
|
|
(run-with-timer 5 3 #'madots--cleanup)))
|
|
|
|
(use-package hyperbole
|
|
:diminish
|
|
:general (general-define-key
|
|
:states 'normal
|
|
"RET" 'hkey-either))
|
|
|
|
(use-package dconf-mode
|
|
:straight
|
|
(:type git
|
|
:repo "https://git.mitchmarq42.xyz/mitch/dconf-mode.el"))
|
|
|
|
(use-package info-variable-pitch
|
|
:straight
|
|
(:type git :host github
|
|
:repo "kisaragi-hiu/info-variable-pitch")
|
|
:config
|
|
(add-hook 'Info-mode-hook #'info-variable-pitch-mode))
|
|
|
|
;; (use-package exwm
|
|
;; ;; :init
|
|
;; ;; (require 'exwm-config)
|
|
;; ;; (exwm-config-example))
|
|
|
|
(use-package ani-el
|
|
:straight (:type git :repo "https://git.mitchmarq42.xyz/mitch/ani-el"
|
|
:files ("ani-el.el" "lib")))
|
|
|
|
(use-package slime
|
|
:if (file-exists-p (expand-file-name "~/quicklisp/slime-helper.el"))
|
|
:custom (inferior-lisp-program "sbcl")
|
|
:init (load (expand-file-name "~/quicklisp/slime-helper.el")))
|
|
|
|
;; built in spell checker, for losers
|
|
(use-package flyspell
|
|
:straight (:type built-in)
|
|
:diminish
|
|
:custom
|
|
(flyspell-auto-correct-word t)
|
|
:hook
|
|
(org-mode . flyspell-mode))
|
|
|
|
;; Java never looked so useful...
|
|
(use-package clojure-mode)
|
|
(use-package inf-clojure)
|
|
|
|
;; unique buffer names
|
|
(use-package uniquify
|
|
:straight (:type built-in)
|
|
:custom (uniquify-buffer-name-style 'forward))
|
|
|
|
;; cache file cleanup
|
|
(use-package kkc
|
|
:straight (:type built-in)
|
|
:custom (kkc-init-file-name (expand-file-name "kkcrc" backup-directory)))
|
|
|
|
;; see https://www.reddit.com/r/emacs/comments/xyo2fo/orgmode_vterm_tmux/
|
|
(use-package ob-tmux
|
|
:after (org dash)
|
|
:config
|
|
(setq org-src-lang-modes (-replace
|
|
'("tmux" . sh)
|
|
'("tmux" . powershell)
|
|
org-src-lang-modes))
|
|
:custom
|
|
(org-babel-default-header-args:tmux
|
|
'((:results . "display")
|
|
(:session . "default")
|
|
(:socket . nil)))
|
|
(org-babel-tmux-session-prefix "ob-")
|
|
(org-babel-tmux-terminal "/home/mitch/.local/bin/emacs-term-shim.sh")
|
|
(org-babel-tmux-terminal-opts))
|
|
|
|
(use-package dwim-shell-command
|
|
:straight (:files (:defaults "dwim-shell-commands.el"))
|
|
:config (require 'dwim-shell-commands)
|
|
:commands dwim-shell-commands-kill-process)
|
|
|
|
(use-package youtube-sub-extractor
|
|
:straight (:type git :host github :repo "agzam/youtube-sub-extractor.el")
|
|
:custom (youtube-sub-extractor-timestamps 'left-margin)
|
|
:commands youtube-sub-extractor-extract-subs)
|
|
|
|
;; Cheat sheet
|
|
(use-package cheat-sh
|
|
:straight (:type git :host github :repo "davep/cheat-sh.el")
|
|
:commands cheat-sh)
|
|
|
|
(provide 'mitch-packages)
|
|
;;; mitch-packages.el ends here
|