More emacs config updates

Still moving too quickly for comprehensive commit messages
This commit is contained in:
Ian Keane 2023-11-24 22:56:08 -05:00
parent 35de62d479
commit f4c1ff6551

View file

@ -68,27 +68,20 @@ To get started, run =C-c C-v t=
(ensure-directory "~/notes/roam") (ensure-directory "~/notes/roam")
(ensure-directory "~/notes/deft") (ensure-directory "~/notes/deft")
(ensure-directory "~/notes/code") (ensure-directory "~/notes/code")
(ensure-directory "~/.config/emacs/video")
(ensure-directory "~/.config/emacs/audio")
(setq deft-directory "~/notes/deft" (setq deft-directory "~/notes/deft"
org-roam-directory "~/notes/roam" org-roam-directory "~/notes/roam"
projectile-project-search-path '("~/code/") projectile-project-search-path '("~/code/")
empv-video-dir "~/.config/emacs/video"
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)))
#+end_src #+end_src
** Helper Functions ** Helper Functions
#+begin_src emacs-lisp #+begin_src emacs-lisp
(defun split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1))
(defun split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1))
(defun custom/eval-region-or-buffer () (defun custom/eval-region-or-buffer ()
"Eval the region if anything is selected, otherwise eval the whole buffer." "Eval the region if anything is selected, otherwise eval the whole buffer."
@ -124,8 +117,7 @@ To get started, run =C-c C-v t=
* Org Mode * Org Mode
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package org) (use-package org)
; (add-hook 'org-mode-hook 'yas-minor-mode)
; (add-hook 'org-mode-hook 'yas-minor-mode)
(org-babel-do-load-languages (org-babel-do-load-languages
'org-babel-load-languages 'org-babel-load-languages
'((emacs-lisp . t) '((emacs-lisp . t)
@ -133,11 +125,19 @@ To get started, run =C-c C-v t=
(setq org-confirm-babel-evaluate nil) (setq org-confirm-babel-evaluate nil)
;; (use-package org-tempo) (require 'org-tempo)
(add-to-list 'org-structure-template-alist '("sh" . "src shell")) (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
(add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")) (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp"))
(use-package org-make-toc
:hook (org-mode . org-make-toc-mode))
(add-to-list 'org-structure-template-alist '("py" . "src python")) (add-to-list 'org-structure-template-alist '("py" . "src python"))
(setq org-hide-emphasis-markers t)
(use-package org-appear
:hook (org-mode . org-appear-mode))
#+end_src #+end_src
* Basic Appearance and Behaviors * Basic Appearance and Behaviors
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -174,29 +174,73 @@ To get started, run =C-c C-v t=
(add-hook mode (lambda () (display-line-numbers-mode 0)))) (add-hook mode (lambda () (display-line-numbers-mode 0))))
(column-number-mode) (column-number-mode)
(use-package default-text-scale
:defer 1
:config
(default-text-scale-mode))
(use-package rainbow-delimiters (use-package rainbow-delimiters
:hook (prog-mode . rainbow-delimiters-mode)) :hook (prog-mode . rainbow-delimiters-mode))
(use-package helpful) ; Slightly more helpful help (use-package helpful) ; Slightly more helpful help
(setq tab-always-indent 'complete) (setq tab-always-indent 'complete)
(setq tab-first-completion 'word) (setq tab-first-completion 'word)
;; Generate buffers in last window
(setq display-buffer-base-action
'(display-buffer-reuse-mode-window
display-buffer-reuse-window
display-buffer-same-window))
;; If a popup does happen, don't resize windows to be equal-sized
(setq even-window-sizes nil)
#+end_src #+end_src
* Navigation * Navigation
** Windows ** Helper Functions
#+begin_src emacs-lisp
(defun split-and-follow-horizontally ()
(interactive)
(split-window-below)
(balance-windows)
(other-window 1))
(defun split-and-follow-vertically ()
(interactive)
(split-window-right)
(balance-windows)
(other-window 1))
#+end_src
** Direct keymaps
#+begin_src emacs-lisp #+begin_src emacs-lisp
(global-set-key (kbd "s-c") 'delete-window) (global-set-key (kbd "s-c") 'delete-window)
(global-set-key (kbd "s-h") 'windmove-left) (global-set-key (kbd "s-h") 'windmove-left)
(global-set-key (kbd "s-j") 'windmove-down) (global-set-key (kbd "s-j") 'windmove-down)
(global-set-key (kbd "s-k") 'windmove-up) (global-set-key (kbd "s-k") 'windmove-up)
(global-set-key (kbd "s-l") 'windmove-right) (global-set-key (kbd "s-l") 'windmove-right)
; (define-key evil-normal-state-map (kbd "s-d") 'kill-this-buffer) ; (define-key evil-normal-state-map (kbd "s-d") 'kill-this-buffer)
; (define-key evil-normal-state-map (kbd "s-n") 'projectile-next-project-buffer) ; (define-key evil-normal-state-map (kbd "s-n") 'projectile-next-project-buffer)
; (define-key evil-normal-state-map (kbd "s-p") 'projectile-previous-project-buffer) ; (define-key evil-normal-state-map (kbd "s-p") 'projectile-previous-project-buffer)
; (define-key evil-normal-state-map (kbd "s-J") 'split-and-follow-horizontally) ; (define-key evil-normal-state-map (kbd "s-J") 'split-and-follow-horizontally)
; (define-key evil-normal-state-map (kbd "s-L") 'split-and-follow-vertically) ; (define-key evil-normal-state-map (kbd "s-L") 'split-and-follow-vertically)
; (define-key evil-normal-state-map (kbd "s-b") 'buffer-menu) ; (define-key evil-normal-state-map (kbd "s-b") 'buffer-menu)
; (define-key evil-normal-state-map (kbd "s-x") 'execute-extended-command) ; (define-key evil-normal-state-map (kbd "s-x") 'execute-extended-command)
(global-set-key (kbd "s-SPC") 'tab-next) (global-set-key (kbd "s-SPC") 'tab-next)
(global-set-key (kbd "<escape>") 'keyboard-escape-quit)
(use-package winner
:after evil
:config
(winner-mode))
#+end_src
** Workspaces
#+begin_src emacs-lisp
(use-package perspective)
(unless (equal persp-mode t)
(persp-mode))
#+end_src #+end_src
** Dired ** Dired
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -381,7 +425,7 @@ To get started, run =C-c C-v t=
"h<return>" '(info-emacs-manual :which-key "Emacs manual") "h<return>" '(info-emacs-manual :which-key "Emacs manual")
"h'" '(describe-char :which-key "Describe character") "h'" '(describe-char :which-key "Describe character")
"ha" '(counsel-apropos :which-key "Apropos") "ha" '(counsel-apropos :which-key "Apropos")
"hb" '(counsel-descbinds :which-key "Describe bindings") "hb" '(embark-bindings :which-key "Describe bindings")
"he" '(view-echo-area-messages :which-key "View echo area messages") "he" '(view-echo-area-messages :which-key "View echo area messages")
"hf" '(helpful-function :which-key "Describe function") "hf" '(helpful-function :which-key "Describe function")
"hi" '(info :which-key "Info") "hi" '(info :which-key "Info")
@ -587,8 +631,39 @@ Idk I think this came from the vertico readme
#+end_src #+end_src
** Embark ** Embark
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package embark-consult) (use-package embark
:ensure t
:bind
(("C-." . embark-act) ;; pick some comfortable binding
("C-;" . embark-dwim) ;; good alternative: M-.
("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
:init
;; Show the Embark target at point via Eldoc. You may adjust the Eldoc
;; strategy, if you want to see the documentation from multiple providers.
(add-hook 'eldoc-documentation-functions #'embark-eldoc-first-target)
:config
;; Hide the mode line of the Embark live/completions buffers
(add-to-list 'display-buffer-alist
'("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
nil
(window-parameters (mode-line-format . none)))))
;; Consult users will also want the embark-consult package.
(use-package embark-consult
:ensure t ; only need to install it, embark loads it after consult if found
:hook
(embark-collect-mode . consult-preview-at-point-mode))
#+end_src #+end_src
** Snippets
#+begin_src emacs-lisp
(use-package yasnippet)
(use-package yasnippet-snippets)
(yas-global-mode)
#+end_src
<el
* Languages * Languages
** LSP ** LSP
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -624,11 +699,32 @@ Idk I think this came from the vertico readme
(use-package terraform-mode (use-package terraform-mode
:ensure t) :ensure t)
#+end_src #+end_src
** Lisp
All lisp-family languages
#+begin_src emacs-lisp
(use-package lispy)
(use-package lispyville
:init
(general-add-hook '(emacs-lisp-mode-hook lisp-mode-hook) #'lispyville-mode)
:config
(lispyville-set-key-theme '(operators c-w additional)))
#+end_src
* Shells
** Enable fish completions
Uses the external fish program to provide fish-style completions to eshell etc
#+begin_src emacs-lisp
(use-package fish-completion)
(when (and (executable-find "fish")
(require 'fish-completion nil t))
(global-fish-completion-mode))
#+end_src
* Git * Git
#+begin_src emacs-lisp #+begin_src emacs-lisp
(use-package git-gutter+) (use-package git-gutter+)
(global-git-gutter+-mode t) (global-git-gutter+-mode t)
(use-package magit) (use-package magit)
(use-package magit-todos)
(setq magit-display-buffer-function 'switch-to-buffer)
#+end_src #+end_src
* Meow * Meow
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -745,30 +841,38 @@ Idk I think this came from the vertico readme
:ensure t :ensure t
:config :config
(evil-collection-init)) (evil-collection-init))
(setq evil-want-C-u-scroll t)
(setq evil-want-C-i-jump nil)
(setq evil-respect-visual-line-mode t)
#+end_src #+end_src
* Web browsing and youtube * Web browsing and youtube
#+begin_src emacs-lisp #+begin_src emacs-lisp
;; Using straight: ;; Using straight:
;;(use-package empv ;;(use-package empv
;; :straight (:host github :repo "isamert/empv.el")) ;; :straight (:host github :repo "isamert/empv.el"))
(use-package empv) (use-package empv)
(setq empv-radio-channels
'(("SomaFM - Groove Salad" . "http://www.somafm.com/groovesalad.pls")
("SomaFM - Drone Zone" . "http://www.somafm.com/dronezone.pls")
("SomaFM - Sonic Universe" . "https://somafm.com/sonicuniverse.pls")
("SomaFM - Metal" . "https://somafm.com/metal.pls")
("SomaFM - Vaporwaves" . "https://somafm.com/vaporwaves.pls")
("ADHD 1" . "https://www.youtube.com/watch?v=CmMrm4BpQHU")
("WREK FM" . "http://streaming.wrek.org:8000/wrek_live-128kb.m3u")
))
;; Todo: lainchan? adhd music stream from youtube? wuog? wrekFM? does freeside have streaming radio?
(with-eval-after-load 'embark (empv-embark-initialize-extra-actions))
(add-to-list 'empv-mpv-args "--ytdl-format=best")
(add-to-list 'empv-mpv-args "--save-position-on-quit")
(add-hook 'empv-init-hook #'empv-override-quit-key)
(setq empv-invidious-instance "https://invidious.projectsegfau.lt/api/v1")
(setq empv-radio-channels
'(("SomaFM - Groove Salad" . "http://www.somafm.com/groovesalad.pls")
("SomaFM - Drone Zone" . "http://www.somafm.com/dronezone.pls")
("SomaFM - Sonic Universe" . "https://somafm.com/sonicuniverse.pls")
("SomaFM - Metal" . "https://somafm.com/metal.pls")
("SomaFM - Vaporwaves" . "https://somafm.com/vaporwaves.pls")
("ADHD 1" . "https://www.youtube.com/watch?v=CmMrm4BpQHU")
("WREK FM" . "http://streaming.wrek.org:8000/wrek_live-128kb.m3u")
))
;; Todo: lainchan? adhd music stream from youtube? wuog? wrekFM? does freeside have streaming radio?
(with-eval-after-load 'embark (empv-embark-initialize-extra-actions))
(add-to-list 'empv-mpv-args "--ytdl-format=best")
(add-to-list 'empv-mpv-args "--save-position-on-quit")
(add-hook 'empv-init-hook #'empv-override-quit-key)
#+end_src #+end_src
* Todo * Todo
** General ** General
- Refactor to use use-package more effectively - Refactor to use use-package more effectively
@ -781,10 +885,6 @@ Idk I think this came from the vertico readme
** New functions ** New functions
- Git-time-machine-or-vc-region-history - Git-time-machine-or-vc-region-history
** Screen management
- perspective
- workspaces?
** Note taking ** Note taking
- deft - deft
- org : roam2, hugo, pretty, dragndrop, bullet - org : roam2, hugo, pretty, dragndrop, bullet
@ -803,13 +903,8 @@ Idk I think this came from the vertico readme
- brighter modeline - brighter modeline
- surpress global minor modes - surpress global minor modes
- Undo-Tree, company, flycheck, which-key - Undo-Tree, company, flycheck, which-key
- always follow new buffers
- ignore case in imenu - ignore case in imenu
- improve which-key visibility - improve which-key visibility
- Fix escape in minibuffer
- Open buffers in same window
- Winner undo
- How to format code blocks in org mode
** LSP stuff ** LSP stuff
- look into treemacs integrations - look into treemacs integrations
@ -824,13 +919,19 @@ Idk I think this came from the vertico readme
- get vertico as completion box - get vertico as completion box
** Keybindings ** Keybindings
- 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
- bind persp-mode
- bind lispy for colemak-dh
- bind lispy doc features and ide-like features
- bind embark
- 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 - 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 - window size functions, winner undo/redo
- map default-text-scale operations
- empv - empv
- map - map
- empv-play-radio - empv-play-radio
@ -857,6 +958,7 @@ Idk I think this came from the vertico readme
- empv-play-file - empv-play-file
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).
@ -869,7 +971,6 @@ variables and their documentations).
- embark? - embark?
- emms, emms-play-url binding (youtube view) - emms, emms-play-url binding (youtube view)
- [[https://youtu.be/UtqE-lR2HCA?t=5134][consult-lsp]] (better for errors than treemacs integrations probably) - [[https://youtu.be/UtqE-lR2HCA?t=5134][consult-lsp]] (better for errors than treemacs integrations probably)
- workspaces / persp mode
- srht.el - srht.el
- affe - affe
- gnus - gnus
@ -881,11 +982,12 @@ variables and their documentations).
** Research ** Research
- What does C-d do when in a minibuffer for vertico? - What does C-d do when in a minibuffer for vertico?
- embark
** System crafters videos ** System crafters videos
- [[https://www.youtube.com/watch?v=CUkuyW6hr18][5 Hacks to improve org roam]] - [[https://www.youtube.com/watch?v=CUkuyW6hr18][5 Hacks to improve org roam]]
- [[https://www.youtube.com/watch?v=C1kwStlEick][Improving the IRC experience]] - [[https://www.youtube.com/watch?v=C1kwStlEick][Improving the IRC experience]]
- [[https://www.youtube.com/watch?v=J0OaRy85MOo][Stremlined completions with vertico]] - [[https://www.youtube.com/watch?v=J0OaRy85MOo][Streamlined completions with vertico]]
- [[https://www.youtube.com/watch?v=XZjyJG-sFZI][Keeping your folders clean while using emacs]] - [[https://www.youtube.com/watch?v=XZjyJG-sFZI][Keeping your folders clean while using emacs]]
- [[https://www.youtube.com/watch?v=zMzkorlfqLA][Static site generator from org mode]] - [[https://www.youtube.com/watch?v=zMzkorlfqLA][Static site generator from org mode]]
- [[https://www.youtube.com/watch?v=za99DwdZEyg][Automated website publishing w/ org and sourcehut]] - [[https://www.youtube.com/watch?v=za99DwdZEyg][Automated website publishing w/ org and sourcehut]]
@ -897,3 +999,7 @@ variables and their documentations).
** Clean up Org Roam ** Clean up Org Roam
- Major mode notes master node - Major mode notes master node
** Create yasnippets repo as per [[https://github.com/joaotavora/yasnippet#where-are-the-snippets][The docs]]