Last weeks changes for emacs config

This commit is contained in:
Ian Keane 2023-12-04 10:20:24 -05:00
parent fb148c5f8f
commit cbeb8faac6

View file

@ -1,8 +1,8 @@
#+title Ian's Emacs Config
#+PROPERTY: header-args:emacs-lisp :tangle (if (eq system-type 'darwin) "~/dotfiles/guix/init.el" "~/.config/emacs/init.el") #+PROPERTY: header-args:emacs-lisp :tangle (if (eq system-type 'darwin) "~/dotfiles/guix/init.el" "~/.config/emacs/init.el")
#+OPTIONS: toc:nil title:nil
#+EXPORT_FILE_NAME: ~/code/website/src/content/dotfiles/emacs.md #+EXPORT_FILE_NAME: ~/code/website/src/content/dotfiles/emacs.md
#+begin_src #+BEGIN_EXPORT markdown
+++ +++
title = "Emacs Configuration" title = "Emacs Configuration"
author = ["Ian Keane"] author = ["Ian Keane"]
@ -10,12 +10,13 @@ date = 2023-02-09
tags = ["Config", "Text editing"] tags = ["Config", "Text editing"]
description = 'My emacs configuration.' description = 'My emacs configuration.'
+++ +++
#+end_src #+END_EXPORT
* Preamble * Preamble
My emacs configuration. It tangles to =.emacs.d/init.el= and exports to this markdown file on save. If you're viewing this in a repo, it's better to visit the website at <https://iankeane.srht.site/dotfiles>. If you are viewing this on the website and want the repo, you can find it at <https://sr.ht/~iankeane/dotfiles>. To see the hugo front-matter configuration, you'll have to view the raw code. My emacs configuration. It tangles to =.emacs.d/init.el= and exports to this markdown file on save. If you're viewing this in a repo, it's better to visit the website at <https://iankeane.srht.site/dotfiles>. If you are viewing this on the website and want the repo, you can find it at <https://sr.ht/~iankeane/dotfiles>. To see the hugo front-matter configuration, you'll have to view the raw code.
#+TOC: headlines 2
* First things first * First things first
** Literate Config Setup ** Literate Config Setup
To get started, run =C-c C-v t= To get started, run =C-c C-v t=
@ -31,7 +32,7 @@ To get started, run =C-c C-v t=
(add-hook 'after-save-hook #'dotfiles/org-babel-tangle-config))) (add-hook 'after-save-hook #'dotfiles/org-babel-tangle-config)))
#+end_src #+end_src
** Package initialization ** Package initialization
- =TODO:= savehist mode doesn't seem to save the history correctly =TODO:= savehist mode doesn't seem to save the history correctly
#+begin_src emacs-lisp #+begin_src emacs-lisp
(require 'package) (require 'package)
@ -138,6 +139,12 @@ Eventually I'll set this up so that all these directories are set in the config
(interactive) (interactive)
(load-file user-init-file)) (load-file user-init-file))
#+end_src #+end_src
** Evil-want-keybinding
Setting this in the :init of evil doesn't work for some reason. It has to be early in the file
=TODO:= find a better solution
#+begin_src emacs-lisp
(setq evil-want-keybinding nil)
#+end_src
* Basic Appearance and Behaviors * Basic Appearance and Behaviors
** Font and Theme ** Font and Theme
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -207,6 +214,7 @@ Eventually I'll set this up so that all these directories are set in the config
#+end_src #+end_src
** Behavioral Tweaks ** Behavioral Tweaks
#+begin_src emacs-lisp #+begin_src emacs-lisp
(when IS-MACOS (when IS-MACOS
(setq mac-pass-command-to-system nil)) (setq mac-pass-command-to-system nil))
@ -255,7 +263,9 @@ Eventually I'll set this up so that all these directories are set in the config
(other-window 1)) (other-window 1))
#+end_src #+end_src
** Windows and Workspaces ** Windows and Workspaces
[[https://github.com/abo-abo/ace-window/issues/216][Credit]] for manual dispatch function. =TODO:= Window width controls [[https://github.com/abo-abo/ace-window/issues/216][Credit]] for manual dispatch function.
=TODO:= Window width controls
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package winner (use-package winner
:after evil :after evil
@ -371,7 +381,7 @@ I know these could be bound on a per-package basis, but since this is my primary
;; Top level bindings ;; Top level bindings
"SPC" '(projectile-find-file :which-key "Find project file") "SPC" '(projectile-find-file :which-key "Find project file")
"<backspace>" '(ian/treemacs-open-current-or-jump :which-key "Find current file in sidebar") "<backspace>" '(ian/treemacs-open-current-or-jump :which-key "Find current file in sidebar")
"," '(+ivy/switch-workspace-buffer :which-key "Buffers (workspace)") "," '(prochectile-ibuffer :which-key "Buffers (workspace)")
"/" '(consult-ripgrep :which-key "Search project") "/" '(consult-ripgrep :which-key "Search project")
":" '(execute-extended-command :which-key "M-x") ":" '(execute-extended-command :which-key "M-x")
";" '(eval-expression :which-key "Eval") ";" '(eval-expression :which-key "Eval")
@ -379,7 +389,7 @@ I know these could be bound on a per-package basis, but since this is my primary
"x" '(scratch-buffer :which-key "Scratch popup") "x" '(scratch-buffer :which-key "Scratch popup")
"-" '(dired :which-key "Find Directory") "-" '(dired :which-key "Find Directory")
"d" '(docker :which-key "Docker") "d" '(docker :which-key "Docker")
"i" '(ian/conditional-imenu :which-key "Imenu") ;; consult-outline? "i" '(ian/conditional-imenu :which-key "Imenu")
"w" '(ace-window :which-key "Window") "w" '(ace-window :which-key "Window")
"W" '(ace-window-manual-dispatch :which-key "Window (dispatch)") "W" '(ace-window-manual-dispatch :which-key "Window (dispatch)")
@ -415,6 +425,7 @@ I know these could be bound on a per-package basis, but since this is my primary
"cd" '(+lookup/definition :which-key "Goto definition") "cd" '(+lookup/definition :which-key "Goto definition")
"cr" '(+lookup/references :which-key "Goto references") "cr" '(+lookup/references :which-key "Goto references")
"ce" '(ian/eval-region-or-buffer :which-key "Eval buffer/region") "ce" '(ian/eval-region-or-buffer :which-key "Eval buffer/region")
"cE" '(consult-flymake :which-key "Errors")
;; "cf" '(NOT A COMMAND (re-do) :which-key "Format buffer/region") ;; "cf" '(NOT A COMMAND (re-do) :which-key "Format buffer/region")
"ci" '(+lookup/implementations :which-key "Find implementations") "ci" '(+lookup/implementations :which-key "Find implementations")
"cj" '(lsp-ivy-workspace-symbol :which-key "Goto symbol (curr. workspace)") "cj" '(lsp-ivy-workspace-symbol :which-key "Goto symbol (curr. workspace)")
@ -422,6 +433,7 @@ I know these could be bound on a per-package basis, but since this is my primary
"ck" '(+lookup/documentation :which-key "Jump to documentation") "ck" '(+lookup/documentation :which-key "Jump to documentation")
"cl" '(+default/lsp-command-map :which-key "LSP") "cl" '(+default/lsp-command-map :which-key "LSP")
"co" '(lsp-organize-imports :which-key "LSP organize imports") "co" '(lsp-organize-imports :which-key "LSP organize imports")
"cp" '(completion-at-point :which-key "Completion at point")
"cR" '(lsp-rename :which-key "LSP rename") "cR" '(lsp-rename :which-key "LSP rename")
"cs" '(+eval/send-region-to-repl :which-key "Send to repl") "cs" '(+eval/send-region-to-repl :which-key "Send to repl")
"ct" '(+lookup/type-definition :which-key "Find type definition") "ct" '(+lookup/type-definition :which-key "Find type definition")
@ -464,10 +476,11 @@ I know these could be bound on a per-package basis, but since this is my primary
"gh" '(:ignore t :which-key "hunk") "gh" '(:ignore t :which-key "hunk")
"ghn" '(+vc-gutter/previous-hunk :which-key "jump to previous hunk") "ghn" '(git-gutter+-previous-hunk :which-key "jump to previous hunk")
"ghp" '(+vc-gutter/next-hunk :which-key "jump to next hunk") "ghp" '(git-gutter+-next-hunk :which-key "jump to next hunk")
"ghr" '(+vc-gutter/revert-hunk :which-key "revert hunk at point") "ghr" '(git-gutter+-revert-hunk :which-key "revert hunk at point")
"ghs" '(+vc-gutter/stage-hunk :which-key "stage hunk at point") "ghs" '(git-gutter+-popup-hunk :which-key "show hunk")
"ghS" '(git-gutter+-stage-hunk :which-key "stage hunk at point")
"gl" '(:ignore t :which-key "list") "gl" '(:ignore t :which-key "list")
"gli" '(forge-list-issues :which-key "list issues") "gli" '(forge-list-issues :which-key "list issues")
@ -499,6 +512,8 @@ I know these could be bound on a per-package basis, but since this is my primary
"hl" '(view-lossage :which-key "View actions log") "hl" '(view-lossage :which-key "View actions log")
"hm" '(describe-mode :which-key "Describe mode") "hm" '(describe-mode :which-key "Describe mode")
"ho" '(helpful-symbol :which-key "Describe symbol") "ho" '(helpful-symbol :which-key "Describe symbol")
"hp" '(explain-pause-top :which-key "Processes")
"hs" '(yas-desrcibe-tables :which-key "Describe symbol")
"hv" '(helpful-variable :which-key "Describe variable") "hv" '(helpful-variable :which-key "Describe variable")
"hx" '(helpful-command :which-key "Describe command") "hx" '(helpful-command :which-key "Describe command")
"hA" '(apropos-documentation :which-key "Apropos(documentation)") "hA" '(apropos-documentation :which-key "Apropos(documentation)")
@ -554,6 +569,7 @@ I know these could be bound on a per-package basis, but since this is my primary
"nb" '(org-roam-buffer-display-dedicated :which-key "Launch roam buffer") "nb" '(org-roam-buffer-display-dedicated :which-key "Launch roam buffer")
"ns" '(org-roam-db-sync :which-key "Sync database") "ns" '(org-roam-db-sync :which-key "Sync database")
"nc" '(org-roam-capture :which-key "Capture to node") "nc" '(org-roam-capture :which-key "Capture to node")
"ni" '(org-roam-insert :which-key "Insert node at point")
;; Org mode ;; Org mode
"o" '(:ignore t :which-key "org") "o" '(:ignore t :which-key "org")
@ -608,16 +624,17 @@ I know these could be bound on a per-package basis, but since this is my primary
"v" '(:ignore t :which-key "visual/appearance") "v" '(:ignore t :which-key "visual/appearance")
"vt" '(load-theme :which-key "load theme") "vt" '(load-theme :which-key "load theme")
;; TODO: maybe make this mode-specific stuff, not using workspaces
;; Workspaces ;; Workspaces
"TAB TAB" '(+workspace/display :which-key "Display tab bar") ;; "TAB TAB" '(+workspace/display :which-key "Display tab bar")
"TAB d" '(+workspace/delete :which-key "Delete this workspace") ;; "TAB d" '(+workspace/delete :which-key "Delete this workspace")
"TAB l" '(+workspace/load :which-key "Load workspace from file") ;; "TAB l" '(+workspace/load :which-key "Load workspace from file")
"TAB n" '(+workspace/new :which-key "New workspace") ;; "TAB n" '(+workspace/new :which-key "New workspace")
"TAB N" '(+workspace/new-named :which-key "New named workspace") ;; "TAB N" '(+workspace/new-named :which-key "New named workspace")
"TAB r" '(+workspace/rename :which-key "Rename workspace") ;; "TAB r" '(+workspace/rename :which-key "Rename workspace")
"TAB R" '(+workspace/restore-last-session :which-key "Restore last session") ;; "TAB R" '(+workspace/restore-last-session :which-key "Restore last session")
"TAB s" '(+workspace/save :which-key "Save workspace") ;; "TAB s" '(+workspace/save :which-key "Save workspace")
"TAB x" '(+workspace/kill-session :which-key "Delete session") ;; "TAB x" '(+workspace/kill-session :which-key "Delete session")
)) ))
#+end_src #+end_src
@ -845,10 +862,12 @@ All lisp-family languages
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package markdown-mode) (use-package markdown-mode)
(use-package evil-markdown (use-package evil-markdown
:after evil
:straight (evil-markdown :type git :host github :repo "somelauw/evil-markdown")
:mode ("\\.md\\'" . evil-markdown-mode)) :mode ("\\.md\\'" . evil-markdown-mode))
(use-package json-mode) (use-package json-mode)
(use-package yaml-mode) (use-package yaml-mode)
#+end_src #+end_src
** Beancount ** Beancount
This is mostly lifted from the doom emacs config. Beancount-mode by default has a pretty borked tab function. This is mostly lifted from the doom emacs config. Beancount-mode by default has a pretty borked tab function.
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -895,6 +914,11 @@ Uses the external fish program to provide fish-style completions to eshell etc
(global-set-key (kbd "<escape>") 'keyboard-escape-quit) (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 "j") 'evil-next-visual-line)
(define-key evil-normal-state-map (kbd "k") 'evil-previous-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)
(evil-mode 1)) (evil-mode 1))
(use-package undo-tree (use-package undo-tree
@ -915,11 +939,9 @@ Uses the external fish program to provide fish-style completions to eshell etc
:ensure t :ensure t
:diminish evil-collection-unimpaired-mode :diminish evil-collection-unimpaired-mode
:init :init
(setq evil-want-C-u-scroll t)
:config :config
(evil-collection-init) (setq evil-respect-visual-line-mode t)
(setq evil-want-C-i-jump t (evil-collection-init))
evil-respect-visual-line-mode t))
(use-package evil-commentary (use-package evil-commentary
:config :config
@ -952,6 +974,15 @@ Uses the external fish program to provide fish-style completions to eshell etc
#+end_src #+end_src
* Emacs Meta
** Explain-Pause
Scrutinize which processes are gumming up emacs
#+begin_src emacs-lisp
(use-package explain-pause-mode
:straight (explain-pause-mode :type git :host github :repo "lastquestion/explain-pause-mode")
:config
(explain-pause-mode))
#+end_src
* Todo * Todo
** General ** General
- Refactor to use use-package more effectively - Refactor to use use-package more effectively
@ -1006,11 +1037,14 @@ Uses the external fish program to provide fish-style completions to eshell etc
- map hyper bindings for buffer nav and jumping - map hyper bindings for buffer nav and jumping
- evil-org - evil-org
- map alignment functions in 'code'section - map alignment functions in 'code'section
- define global meow-left and vim-left, swich contextually
- fix c-u in evil mode - fix c-u in evil mode
- fix tab key - fix tab key
- window size functions, winner undo/redo - window size functions, winner undo/redo
- map default-text-scale operations - map default-text-scale operations
- org-capture from string and org-ripgrep
- move spc p s back to spc p p
- explain-pause spc h p
- Want this for org-roam, don't want to rebind tab here
- empv - empv
- map - map
- configure - configure