A week's worth of emacs config updates

This commit is contained in:
Ian Keane 2023-12-23 22:13:16 -05:00
parent 39c722cfaf
commit 7d28feb884
2 changed files with 201 additions and 104 deletions

2
.gitignore vendored
View file

@ -5,3 +5,5 @@ slackware/home/vim/.vim/autoload/*
slackware/home/vim/.vim/undo/* slackware/home/vim/.vim/undo/*
*.swp *.swp
*.netrwhist *.netrwhist
.DS_Store
slackware/home/doom/.doom.d/config.el

View file

@ -118,6 +118,8 @@ Eventually I'll set this up so that all these directories are set in the config
empv-audio-dir "~/.config/emacs/audio" empv-audio-dir "~/.config/emacs/audio"
backup-directory-alist `(("." . "~/.config/emacs/backups/")) backup-directory-alist `(("." . "~/.config/emacs/backups/"))
auto-save-file-name-transforms `((".*" "~/.config/emacs/autosaves/" t))) auto-save-file-name-transforms `((".*" "~/.config/emacs/autosaves/" t)))
(projectile-mode)
#+end_src #+end_src
** Helper Functions ** Helper Functions
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -198,10 +200,12 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
;; turn off number mode in some contexts ;; turn off number mode in some contexts
(dolist (mode (dolist (mode
'(org-mode-hook '(org-mode-hook
term-mode-hook term-mode-hook
eshell-mode-hook eshell-mode-hook
treemacs-mode-hook)) treemacs-mode-hook
vterm-mode-hook
nov-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0)))) (add-hook mode (lambda () (display-line-numbers-mode 0))))
(column-number-mode) (column-number-mode)
#+end_src #+end_src
@ -240,6 +244,8 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
(setq indent-tabs-mode nil) ; tabs not spaces (setq indent-tabs-mode nil) ; tabs not spaces
(visual-line-mode) ; wrap long lines visually (visual-line-mode) ; wrap long lines visually
(whitespace-mode)
(setq-default indent-tabs-mode nil)
#+end_src #+end_src
** Tab bar ** Tab bar
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -249,6 +255,57 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
(tab-bar-echo-area-mode 1) (tab-bar-echo-area-mode 1)
(setq tab-bar-show nil)) (setq tab-bar-show nil))
#+end_src #+end_src
* Evil
#+begin_src emacs-lisp
(use-package evil
:ensure t
:config
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)
(define-key evil-normal-state-map (kbd "ghp") 'git-gutter+-previous-hunk)
(define-key evil-normal-state-map (kbd "ghn") 'git-gutter+-next-hunk)
(define-key evil-normal-state-map (kbd "ghr") 'git-gutter+-revert-hunk)
(define-key evil-normal-state-map (kbd "ghs") 'git-gutter+-popup-hunk)
(define-key evil-normal-state-map (kbd "ghS") 'git-gutter+-stage-hunk)
(define-key evil-normal-state-map (kbd "gp") nil)
(define-key evil-normal-state-map (kbd "gpn") 'popper-cycle)
(define-key evil-normal-state-map (kbd "gpp") 'popper-cycle-backwards)
(define-key evil-normal-state-map (kbd "gpq") 'popper-kill-latest-popup)
(define-key evil-normal-state-map (kbd "gpt") 'popper-toggle-type)
(define-key evil-normal-state-map (kbd "gbn") 'projectile-next-project-buffer)
(define-key evil-normal-state-map (kbd "gbp") 'projectile-previous-project-buffer)
(evil-mode 1))
(use-package undo-tree
:ensure t
:after evil
:diminish
:config
(evil-set-undo-system 'undo-tree)
(global-undo-tree-mode 1))
(use-package evil-org
:ensure t
:after org
:hook (org-mode . (lambda () evil-org-mode)))
(use-package evil-collection
:after evil
:ensure t
:diminish evil-collection-unimpaired-mode
:init
:config
(setq evil-respect-visual-line-mode t)
(evil-collection-init))
(use-package evil-commentary
:config
(evil-commentary-mode))
#+end_src
* Navigation * Navigation
** Helper Functions ** Helper Functions
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -313,6 +370,7 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
'( '(
(helpful-mode :align right :select t :size 0.3 :popup t) (helpful-mode :align right :select t :size 0.3 :popup t)
(help-mode :align right :select t :size 0.3 :popup t) (help-mode :align right :select t :size 0.3 :popup t)
(compilation-mode :align right :select t :size 0.3 :popup t)
("*shell*" :align below :select t :size 0.3 :popup t) ("*shell*" :align below :select t :size 0.3 :popup t)
("*eshell*" :align below :select t :size 0.3 :popup t) ("*eshell*" :align below :select t :size 0.3 :popup t)
("*vterm*" :align below :select t :size 0.3 :popup t) ("*vterm*" :align below :select t :size 0.3 :popup t)
@ -360,11 +418,11 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
(defun my-dired-init () (defun my-dired-init ()
"Bunch of stuff to run for dired, either immediately or when it's loaded." "Bunch of stuff to run for dired, either immediately or when it's loaded."
(define-key dired-mode-map [remap dired-find-file] (define-key dired-mode-map [remap dired-find-file]
'dired-single-buffer) 'dired-single-buffer)
(define-key dired-mode-map [remap dired-mouse-find-file-other-window] (define-key dired-mode-map [remap dired-mouse-find-file-other-window]
'dired-single-buffer-mouse) 'dired-single-buffer-mouse)
(define-key dired-mode-map [remap dired-up-directory] (define-key dired-mode-map [remap dired-up-directory]
'dired-single-up-directory)) 'dired-single-up-directory))
;; if dired's already loaded, then the keymap will be bound ;; if dired's already loaded, then the keymap will be bound
(if (boundp 'dired-mode-map) (if (boundp 'dired-mode-map)
@ -374,12 +432,18 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
(use-package dired-open (use-package dired-open
:config :config
(setq dired-open-extensions '(("png" . "sxiv") (setq dired-open-extensions '(("png" . "sxiv")
("mkv" . "mpv") ("mkv" . "mpv")
("avi" . "mpv")))) ("avi" . "mpv"))))
;; (eval-after-load 'evil
;; '(evil-define-key 'normal dired-mode-map (kbd "SPC") nil))
(use-package all-the-icons-dired (use-package all-the-icons-dired
:hook (dired-mode . all-the-icons-dired-mode)) :hook (dired-mode . all-the-icons-dired-mode))
#+end_src #+end_src
#+RESULTS:
| all-the-icons-dired-mode | dired-extra-startup |
** Treemacs ** Treemacs
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package treemacs (use-package treemacs
@ -394,12 +458,14 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
to the treemacs window" to the treemacs window"
(interactive) (interactive)
(if (if
(not(eq (treemacs-current-visibility) 'visible)) (not(eq (treemacs-current-visibility) 'visible))
(treemacs-find-file)) (treemacs-find-file))
(treemacs-select-window)) (treemacs-select-window))
(use-package all-the-icons) (use-package all-the-icons)
(use-package treemacs-all-the-icons) (use-package treemacs-all-the-icons)
(use-package treemacs-evil)
#+end_src #+end_src
** Which-key ** Which-key
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -418,10 +484,13 @@ I know these could be bound on a per-package basis, but since this is my primary
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package general (use-package general
:ensure t :ensure t
:after nov evil evil-collection
:config :config
(general-create-definer general-definition (general-create-definer general-definition
:keymaps '(normal insert visual emacs) ;; :keymaps '(normal insert visual emacs nov-mode-map nov-button-map dired-mode-map)
:states '(normal visual)
:keymaps 'override
:prefix "SPC" :prefix "SPC"
:global-prefix "C-SPC") :global-prefix "C-SPC")
@ -717,7 +786,8 @@ I know these could be bound on a per-package basis, but since this is my primary
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
'((emacs-lisp . t) '((emacs-lisp . t)
(python . t))) (python . t)
(mermaid . t)))
(setq org-confirm-babel-evaluate nil) (setq org-confirm-babel-evaluate nil)
@ -736,14 +806,15 @@ I know these could be bound on a per-package basis, but since this is my primary
:custom :custom
(org-roam-directory "~/notes/roam") (org-roam-directory "~/notes/roam")
:config :config
(org-roam-db-autosync-mode)) (org-roam-db-autosync-mode)
(setq org-link-frame-setup '((file . find-file))))
(use-package deft (use-package deft
:commands (deft) :commands (deft)
:config :config
(setq deft-directory "~/notes/deft" (setq deft-directory "~/notes/deft"
deft-extensions '("org" "txt") deft-extensions '("org" "txt")
deft-recursive t)) deft-recursive t))
(use-package ox-hugo (use-package ox-hugo
:after ox) :after ox)
@ -752,11 +823,17 @@ I know these could be bound on a per-package basis, but since this is my primary
:after org-roam :after org-roam
:config :config
(setq org-roam-ui-sync-theme t (setq org-roam-ui-sync-theme t
org-roam-ui-follow t org-roam-ui-follow t
org-roam-ui-update-on-save t org-roam-ui-update-on-save t
org-roam-ui-open-on-start t)) org-roam-ui-open-on-start t))
(use-package ox-gfm) ; github-flavored-markdown exporter (use-package ox-gfm) ; github-flavored-markdown exporter
(use-package ob-mermaid)
(setq ob-mermaid-cli-path "/usr/local/bin/mmdc")
(use-package org-download)
#+end_src #+end_src
* Project management * Project management
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -773,8 +850,9 @@ I know these could be bound on a per-package basis, but since this is my primary
#+end_src #+end_src
** Consult ** Consult
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package consult (use-package consult
:bind (:map minibuffer-local-map ("C-r" . consult-history))) :bind (:map minibuffer-local-map ("C-r" . consult-history)))
(setq consult-rpigrep-args "rg --nul --line buffered --color=never --max-columns=1000 --path-separator / --smart-case --no-heading --with-filename --line-number --search-zip --hidden")
#+end_src #+end_src
** Generic completion ** Generic completion
Idk I think this came from the vertico readme Idk I think this came from the vertico readme
@ -838,6 +916,7 @@ Idk I think this came from the vertico readme
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package embark (use-package embark
:ensure t :ensure t
:after evil evil-collection evil-org
:diminish eldoc-mode :diminish eldoc-mode
:bind :bind
(("C-." . embark-act) ;; pick some comfortable binding (("C-." . embark-act) ;; pick some comfortable binding
@ -847,16 +926,17 @@ Idk I think this came from the vertico readme
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc ;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
;; strategy, if you want to see the documentation from multiple providers. ;; strategy, if you want to see the documentation from multiple providers.
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target) ;; (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
(define-key evil-normal-state-map (kbd "C-.") 'embark-act)
(evil-define-key 'normal evil-normal-state-map (kbd "C-.") embark-act)
:config :config
(with-eval-after-load 'evil
(define-key evil-normal-state-map (kbd "C-.") 'embark-act))
;; Hide the mode line of the Embark live/completions buffers ;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist (add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*" '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil nil
(window-parameters (mode-line-format . none))))) (window-parameters (mode-line-format . none)))))
;; Consult users will also want the embark-consult package. ;; Consult users will also want the embark-consult package.
(use-package embark-consult (use-package embark-consult
@ -872,37 +952,40 @@ Idk I think this came from the vertico readme
targets." targets."
(lambda (&optional keymap targets prefix) (lambda (&optional keymap targets prefix)
(if (null keymap) (if (null keymap)
(which-key--hide-popup-ignore-command) (which-key--hide-popup-ignore-command)
(which-key--show-keymap (which-key--show-keymap
(if (eq (plist-get (car targets) :type) 'embark-become) (if (eq (plist-get (car targets) :type) 'embark-become)
"Become" "Become"
(format "Act on %s '%s'%s" (format "Act on %s '%s'%s"
(plist-get (car targets) :type) (plist-get (car targets) :type)
(embark--truncate-target (plist-get (car targets) :target)) (embark--truncate-target (plist-get (car targets) :target))
(if (cdr targets) "…" ""))) (if (cdr targets) "…" "")))
(if prefix (if prefix
(pcase (lookup-key keymap prefix 'accept-default) (pcase (lookup-key keymap prefix 'accept-default)
((and (pred keymapp) km) km) ((and (pred keymapp) km) km)
(_ (key-binding prefix 'accept-default))) (_ (key-binding prefix 'accept-default)))
keymap) keymap)
nil nil t (lambda (binding) nil nil t (lambda (binding)
(not (string-suffix-p "-argument" (cdr binding)))))))) (not (string-suffix-p "-argument" (cdr binding))))))))
(setq embark-indicators (setq embark-indicators
'(embark-which-key-indicator '(embark-which-key-indicator
embark-highlight-indicator embark-highlight-indicator
embark-isearch-highlight-indicator)) embark-isearch-highlight-indicator))
(defun embark-hide-which-key-indicator (fn &rest args) (defun embark-hide-which-key-indicator (fn &rest args)
"Hide the which-key indicator immediately when using the completing-read prompter." "Hide the which-key indicator immediately when using the completing-read prompter."
(which-key--hide-popup-ignore-command) (which-key--hide-popup-ignore-command)
(let ((embark-indicators (let ((embark-indicators
(remq #'embark-which-key-indicator embark-indicators))) (remq #'embark-which-key-indicator embark-indicators)))
(apply fn args))) (apply fn args)))
(advice-add #'embark-completing-read-prompter (advice-add #'embark-completing-read-prompter
:around #'embark-hide-which-key-indicator) :around #'embark-hide-which-key-indicator)
#+end_src #+end_src
#+RESULTS:
** Snippets ** Snippets
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package yasnippet (use-package yasnippet
@ -920,6 +1003,7 @@ Idk I think this came from the vertico readme
(setq lsp-keymap-prefix "C-c l") (setq lsp-keymap-prefix "C-c l")
:config :config
(lsp-enable-which-key-integration t) (lsp-enable-which-key-integration t)
(setq lsp-headerline-breadcrumb-enable nil)
:hook (terraform-mode . lsp-deferred) :hook (terraform-mode . lsp-deferred)
:hook (rust-mode . lsp-deferred)) :hook (rust-mode . lsp-deferred))
@ -957,6 +1041,11 @@ All lisp-family languages
:config :config
(lispyville-set-key-theme '(operators c-w additional))) (lispyville-set-key-theme '(operators c-w additional)))
#+end_src #+end_src
** Go
#+begin_src emacs-lisp
(use-package go-mode)
(add-hook 'go-mode-hook 'lsp-deferred)
#+end_src
* Markups * Markups
** Markdown ** Markdown
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -988,6 +1077,36 @@ This is mostly lifted from the doom emacs config. Beancount-mode by default has
(add-hook 'beancount-mode-hook #'flymake-bean-check-enable) (add-hook 'beancount-mode-hook #'flymake-bean-check-enable)
#+end_src #+end_src
** Epub
#+begin_src emacs-lisp
(use-package nov
:after evil evil-collection
:config
;; (define-key nov-button-map (kbd "SPC") nil)
;; (evil-define-key 'normal nov-mode-map (kbd "SPC") nil)
;; (evil-define-key 'normal nov-button-map (kbd "SPC") nil)
;; (define-key nov-mode-map (kbd "SPC") nil)
(setq nov-text-width 80))
(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode))
#+end_src
* Containers
** Docker
#+begin_src emacs-lisp
(use-package dockerfile-mode)
(use-package docker-compose-mode)
;; (use-package docker)
;; Todo: lsp-docker? docker-tramp? docker-cli?
#+end_src
** Kubernetes
#+begin_src emacs-lisp
(use-package k8s-mode)
;; kubernetes
;; kubernetes-evil
;; kubernetes-helm
;; kubernetes-tramp
#+end_src
* Shells * Shells
** Enable fish completions ** Enable fish completions
Uses the external fish program to provide fish-style completions to eshell etc Uses the external fish program to provide fish-style completions to eshell etc
@ -1008,54 +1127,6 @@ Uses the external fish program to provide fish-style completions to eshell etc
(use-package git-timemachine) (use-package git-timemachine)
#+end_src #+end_src
* Evil
#+begin_src emacs-lisp
(use-package evil
:ensure t
:config
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(define-key evil-normal-state-map (kbd "j") 'evil-next-visual-line)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-visual-line)
(define-key evil-normal-state-map (kbd "ghp") 'git-gutter+-previous-hunk)
(define-key evil-normal-state-map (kbd "ghn") 'git-gutter+-next-hunk)
(define-key evil-normal-state-map (kbd "ghr") 'git-gutter+-revert-hunk)
(define-key evil-normal-state-map (kbd "ghs") 'git-gutter+-popup-hunk)
(define-key evil-normal-state-map (kbd "ghS") 'git-gutter+-stage-hunk)
(define-key evil-normal-state-map (kbd "gp") nil)
(define-key evil-normal-state-map (kbd "gpn") 'popper-cycle)
(define-key evil-normal-state-map (kbd "gpp") 'popper-cycle-backwards)
(define-key evil-normal-state-map (kbd "gpq") 'popper-kill-latest-popup)
(define-key evil-normal-state-map (kbd "gpt") 'popper-toggle-type)
(define-key evil-normal-state-map (kbd "gbn") 'projectile-next-project-buffer)
(define-key evil-normal-state-map (kbd "gbp") 'projectile-previous-project-buffer)
(evil-mode 1))
(use-package undo-tree
:ensure t
:after evil
:diminish
:config
(evil-set-undo-system 'undo-tree)
(global-undo-tree-mode 1))
(use-package evil-org
:ensure t
:after org
:hook (org-mode . (lambda () evil-org-mode)))
(use-package evil-collection
:after evil
:ensure t
:diminish evil-collection-unimpaired-mode
:init
:config
(setq evil-respect-visual-line-mode t)
(evil-collection-init))
(use-package evil-commentary
:config
(evil-commentary-mode))
#+end_src
* Web browsing and youtube * Web browsing and youtube
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Using straight: ;; Using straight:
@ -1164,7 +1235,10 @@ Scrutinize which processes are gumming up emacs
- Set things which should be set before package install in :init - Set things which should be set before package install in :init
- Disable source editing issue - Disable source editing issue
- Goes away when I run =(defun org-edit-src-code nil)= - Goes away when I run =(defun org-edit-src-code nil)=
- Go through AWB's notes about using gnus
- TODO aggregation
- Suppress evilmarkdown mode and org-roam-ui minor mode
** Terminals ** Terminals
- More terminals - More terminals
- emacs-fish-completions - emacs-fish-completions
@ -1176,11 +1250,16 @@ Scrutinize which processes are gumming up emacs
** Note taking ** Note taking
- deft - deft
- org : roam2, hugo, pretty, dragndrop, bullet - org : roam2, hugo, pretty, dragndrop, bullet
- meetlog reference buffer
- work roam directory
- [[https://www.youtube.com/watch?v=3-sLBaJAtew][Dalies]] for scheduling things
- Fix org indentation stuff
** Lisp stuff ** Lisp stuff
- paredit - paredit
- lispy - lispy
- no tabs for yaml-mode (wtf?)
** One-offs ** One-offs
- hl-todo - hl-todo
- persistent undo - persistent undo
@ -1193,7 +1272,15 @@ Scrutinize which processes are gumming up emacs
- Undo-Tree, company, flycheck, which-key - Undo-Tree, company, flycheck, which-key
- ignore case in imenu - ignore case in imenu
- improve which-key visibility - improve which-key visibility
- gpt popup
- org-roam-buffer popup
- conflicts with global popup buffers
- [[https://old.reddit.com/r/emacs/comments/o04it0/share_your_prettifysymbolsalist/][prettify-symbols-mode]]
** NFS stuff
- map music from nfs
- map books from nfs with nov.el
** LSP stuff ** LSP stuff
- look into treemacs integrations - look into treemacs integrations
- consider eglot - consider eglot
@ -1207,6 +1294,20 @@ Scrutinize which processes are gumming up emacs
- get vertico as completion box - get vertico as completion box
** Keybindings ** Keybindings
- treemacs-open-other-window
- treemacs | to open in split
- init popup buffer binding? spc r i?
- org-roam buffer in popup (follow)
- create-tab-with-name function
- buffer to spc b b local, spc b B global
- do somthing useful with ','
- custom function for toggle between last 2 windows
- custom function to scroll-other-window using last 2 windows
- evil-define-key instead of define-key everywhere
- bind something to create file in dired / treemacs
- fix general prefix in treemacs mode
- fix vim-surround
- snippets help =spc h y=, helpful-symbol =spc h s=
- put general bindings in separate keymaps in separate sections - put general bindings in separate keymaps in separate sections
- map hyper bindings for buffer nav and jumping - map hyper bindings for buffer nav and jumping
- evil-org - evil-org
@ -1242,6 +1343,7 @@ Scrutinize which processes are gumming up emacs
selected radio (See empv-radio-log-file and empv-radio-log-format selected radio (See empv-radio-log-file and empv-radio-log-format
variables and their documentations). variables and their documentations).
** New plugins ** New plugins
- tramp - tramp
- k8s - k8s
@ -1276,10 +1378,3 @@ variables and their documentations).
- [[https://www.youtube.com/watch?v=0C16LLHGYzk&t=1882s][Converting a literate config to guix home]] - [[https://www.youtube.com/watch?v=0C16LLHGYzk&t=1882s][Converting a literate config to guix home]]
- [[https://www.youtube.com/playlist?list=PLEoMzSkcN8oM-kA19xOQc8s0gr0PpFGJQ][Emacs mail playlist]] - [[https://www.youtube.com/playlist?list=PLEoMzSkcN8oM-kA19xOQc8s0gr0PpFGJQ][Emacs mail playlist]]
- [[https://www.youtube.com/watch?v=qk2Is_sC8Lk][Embark]] - [[https://www.youtube.com/watch?v=qk2Is_sC8Lk][Embark]]
** Clean up Org Roam
- Major mode notes master node
** Create yasnippets repo as per [[https://github.com/joaotavora/yasnippet#where-are-the-snippets][The docs]]