More emacs config updates

This commit is contained in:
Ian Keane 2023-12-05 13:09:07 -05:00
parent cbeb8faac6
commit 607ded5d0b

View file

@ -199,10 +199,11 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
(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))
(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
** Buffers ** Buffers
=TODO:= Make this use currently selected buffer =TODO:= Make this use currently selected buffer
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -301,6 +302,51 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
(ace-window arg) (ace-window arg)
)) ))
#+end_src #+end_src
** Shackle
#+begin_src emacs-lisp
(use-package shackle
:config
(shackle-mode))
(setq shackle-rules
'(
(helpful-mode :align right :select t :size 0.3 :popup t)
(help-mode :align right :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)
("*vterm*" :align below :select t :size 0.3 :popup t)
("*scratch*" :align left :select t :size 0.25 :popup t)
(treemacs-mode :align left :select t :size 0.40 :popup t)
("*Messages*" :align right :select t :size 0.25 :popup t))
'(:select t)) ;; Always select newly created windows
#+end_src
** Popper
#+begin_src emacs-lisp
(use-package popper
:after (shackle projectile)
:init
(setq popper-reference-buffers
'(("\\*Messages\\*" . hide)
"\\*Error\\*"
"Output\\*$"
("\\*Warnings\\*" . hide)
"\\*scratch*\\*"
;; "\\*lsp-bridge\\*"
"\\*Async Shell Command\\*"
"^\\*eshell.*\\*$" eshell-mode ;eshell as a popup
"^\\*shell.*\\*$" shell-mode ;shell as a popup
"^\\*term.*\\*$" term-mode ;term as a popup
"^\\*vterm.*\\*$" vterm-mode ;vterm as a popup
helpful-mode
compilation-mode
inferior-python-mode
consult-flymake-mode))
:config
(setq popper-display-control nil)
(popper-mode +1)
(popper-echo-mode +1))
(setq popper-group-function #'popper-group-by-projectile)
#+end_src
** Dired ** Dired
#+begin_src emacs-lisp #+begin_src emacs-lisp
(setq ring-bell-function 'ignore) (setq ring-bell-function 'ignore)
@ -335,14 +381,16 @@ Setting this in the :init of evil doesn't work for some reason. It has to be ear
#+end_src #+end_src
** Treemacs ** Treemacs
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package treemacs) (use-package treemacs
:config
(setq treemacs-width 45))
;; Follow project buffers instantly ;; Follow project buffers instantly
(setq treemacs--project-follow-delay 0) (setq treemacs--project-follow-delay 0)
(defun ian/treemacs-open-current-or-jump () (defun ian/treemacs-open-current-or-jump ()
"Find the current file and open treemacs if it's not open, otherwise jump "Find the current file and open treemacs if it's not open, otherwise jump
to the treemacs window" to the treemacs window"
(interactive) (interactive)
(if (if
(not(eq (treemacs-current-visibility) 'visible)) (not(eq (treemacs-current-visibility) 'visible))
@ -381,12 +429,12 @@ 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")
"," '(prochectile-ibuffer :which-key "Buffers (workspace)") "TAB" '(popper-toggle :which-key "Toggle popup")
"," '(projectile-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")
"<" '(consult-buffer :which-key "Buffers (all)") "<" '(consult-buffer :which-key "Buffers (all)")
"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") "i" '(ian/conditional-imenu :which-key "Imenu")
@ -444,8 +492,9 @@ I know these could be bound on a per-package basis, but since this is my primary
;; File ;; File
"f" '(:ignore t :which-key "File") "f" '(:ignore t :which-key "File")
;; "fp" '(doom/open-private-config :which-key "Browse private config") ;; "fp" '(doom/open-private-config :which-key "Browse private config")
"fr" '(consult-recent-file :which-key "Recent files") "fr" '(projectile-recentf :which-key "Recent files")
"fR" '(ian/reload-config :which-key "Reload config") "fR" '(consult-recent-file :which-key "Recent files")
"fc" '(ian/reload-config :which-key "Reload config")
;; "fm" '(doom/move-this-file :which-key "Move/rename file") ;; "fm" '(doom/move-this-file :which-key "Move/rename file")
;; "fS" '(doom/sudo-find-file :which-key "Sudo find file") ;; "fS" '(doom/sudo-find-file :which-key "Sudo find file")
;; "fs" '(doom/sudo-this-file :which-key "Sudo this file") ;; "fs" '(doom/sudo-this-file :which-key "Sudo this file")
@ -509,11 +558,10 @@ I know these could be bound on a per-package basis, but since this is my primary
"hf" '(helpful-function :which-key "Describe function") "hf" '(helpful-function :which-key "Describe function")
"hi" '(info :which-key "Info") "hi" '(info :which-key "Info")
"hk" '(helpful-key :which-key "Describe key") "hk" '(helpful-key :which-key "Describe key")
"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") "hp" '(explain-pause-top :which-key "Processes")
"hs" '(yas-desrcibe-tables :which-key "Describe symbol") "hs" '(yas-describe-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)")
@ -569,16 +617,17 @@ 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") "ni" '(org-roam-node-insert :which-key "Insert node at point")
;; Org mode ;; Org mode
"o" '(:ignore t :which-key "org") "o" '(:ignore t :which-key "org")
"ol" '(org-store-link :which-key "Org store link") "ol" '(org-store-link :which-key "Store link")
"oc" '(org-capture :which-key "Org Capture") "oc" '(org-capture :which-key "Capture")
"oC" '(org-capture-goto-target :which-key "Goto Capture") "oC" '(org-capture-goto-target :which-key "Goto Capture")
"ot" '(org-babel-tangle :which-key "Org Tangle") "oo" '(org-open-at-point :which-key "Open link")
"oy" '(+org/export-to-clipboard :which-key "Org export to clipboard") "ot" '(org-babel-tangle :which-key "Tangle")
"oY" '(+org/export-to-clipboard-as-rich-text :which-key "Org export to clipboard (rich)") "oy" '(+org/export-to-clipboard :which-key "Export to clipboard")
"oY" '(+org/export-to-clipboard-as-rich-text :which-key "Export to clipboard (rich)")
"oe" '(:ignore t :which-key "export") "oe" '(:ignore t :which-key "export")
"oeh" '(org-html-export-to-html :which-key "Export Org to HTML") "oeh" '(org-html-export-to-html :which-key "Export Org to HTML")
"oa" '(:ignore t :which-key "attach") "oa" '(:ignore t :which-key "attach")
@ -602,6 +651,12 @@ I know these could be bound on a per-package basis, but since this is my primary
"pT" '(projectile-test-project :which-key "Test project") "pT" '(projectile-test-project :which-key "Test project")
"pz" '(+taskrunner/project-tasks :which-key "List project tasks") "pz" '(+taskrunner/project-tasks :which-key "List project tasks")
;; Reference buffers
"r" '(:ignore t :which-key "reference buffers")
"s" '(scratch-buffer :which-key "Scratch")
"m" '(view-echo-area-messages :which-key "Messages")
"c" '(view-lossage :which-key "Commands History")
;; Shell ;; Shell
"s" '(:ignore t :which-key "shell") "s" '(:ignore t :which-key "shell")
"se" '(+eshell/toggle :which-key "Toggle eshell popup") "se" '(+eshell/toggle :which-key "Toggle eshell popup")
@ -791,6 +846,8 @@ Idk I think this came from the vertico readme
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target) (add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
: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\\)\\*"
@ -802,6 +859,45 @@ Idk I think this came from the vertico readme
:ensure t ; only need to install it, embark loads it after consult if found :ensure t ; only need to install it, embark loads it after consult if found
:hook :hook
(embark-collect-mode . consult-preview-at-point-mode)) (embark-collect-mode . consult-preview-at-point-mode))
;; https://github.com/oantolin/embark/wiki/Additional-Configuration#use-which-key-like-a-key-menu-prompt
(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)
#+end_src #+end_src
** Snippets ** Snippets
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -905,6 +1001,8 @@ Uses the external fish program to provide fish-style completions to eshell etc
(use-package magit) (use-package magit)
(use-package magit-todos) (use-package magit-todos)
(setq magit-display-buffer-function 'magit-display-buffer-same-window-except-diff-v1) (setq magit-display-buffer-function 'magit-display-buffer-same-window-except-diff-v1)
(use-package git-timemachine)
#+end_src #+end_src
* Evil * Evil
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -919,6 +1017,13 @@ Uses the external fish program to provide fish-style completions to eshell etc
(define-key evil-normal-state-map (kbd "ghr") 'git-gutter+-revert-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+-popup-hunk)
(define-key evil-normal-state-map (kbd "ghS") 'git-gutter+-stage-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)) (evil-mode 1))
(use-package undo-tree (use-package undo-tree
@ -978,10 +1083,11 @@ Uses the external fish program to provide fish-style completions to eshell etc
** Explain-Pause ** Explain-Pause
Scrutinize which processes are gumming up emacs Scrutinize which processes are gumming up emacs
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package explain-pause-mode ;; (use-package explain-pause-mode
:straight (explain-pause-mode :type git :host github :repo "lastquestion/explain-pause-mode") ;; :straight (explain-pause-mode :type git :host github :repo "lastquestion/explain-pause-mode")
:config ;; :diminish explain-pause-mode
(explain-pause-mode)) ;; :config
;; (explain-pause-mode))
#+end_src #+end_src
* Todo * Todo
** General ** General
@ -1043,6 +1149,7 @@ Scrutinize which processes are gumming up emacs
- map default-text-scale operations - map default-text-scale operations
- org-capture from string and org-ripgrep - org-capture from string and org-ripgrep
- move spc p s back to spc p p - move spc p s back to spc p p
- org eval block
- explain-pause spc h p - explain-pause spc h p
- Want this for org-roam, don't want to rebind tab here - Want this for org-roam, don't want to rebind tab here
- empv - empv
@ -1055,6 +1162,14 @@ Scrutinize which processes are gumming up emacs
- spc m r(adio) - spc m r(adio)
- empv-video-dir empv-audio-dir? - empv-video-dir empv-audio-dir?
- empv-play-file - empv-play-file
- Set display-buffer-alist values for how I want windows treated (integrates with popper), e.g.
#+begin_src emacs-lisp :tangle no
(add-to-list 'display-buffer-alist
'("\\*ielm\\*"
(display-buffer-in-side-window)
(side . left)
(window-width . 50)))
#+end_src
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).