diff --git a/.config/emacs/init.org b/.config/emacs/init.org index ad7ecb4..e3258eb 100644 --- a/.config/emacs/init.org +++ b/.config/emacs/init.org @@ -113,11 +113,12 @@ Then bootstrap This is commented out since it adds ever so slightly to init time, but keep it around in case we need to benchmark slow init times later. -#+begin_src emacs-lisp +#+begin_src emacs-lisp :tangle no (straight-use-package 'benchmark-init) (require 'benchmark-init) (add-hook 'after-init-hook 'benchmark-init/deactivate) #+end_src + ** Misc Stuff #+begin_SRC emacs-lisp @@ -333,6 +334,9 @@ Emacs is an great operating system, if only it had a good text editor... (global-set-key (kbd "C-c d") 'duplicate-line) (global-set-key (kbd "C-c C-;") 'joe/duplicate-line-comment) +(global-set-key (kbd "M-n") (kbd "C-u 1 C-v")) +(global-set-key (kbd "M-p") (kbd "C-u 1 M-v")) + #+end_src *** Hydra #+begin_src emacs-lisp @@ -354,8 +358,131 @@ Emacs is an great operating system, if only it had a good text editor... #+begin_src emacs-lisp (straight-use-package 'multiple-cursors) #+end_src -*** Evil +*** Meow +#+begin_src emacs-lisp :tangle no +(straight-use-package 'meow) +(defun meow-setup () + (setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty) + (meow-motion-overwrite-define-key + '("j" . meow-next) + '("k" . meow-prev) + '("" . ignore)) + (meow-leader-define-key + ;; SPC j/k will run the original command in MOTION state. + '("j" . "H-j") + '("k" . "H-k") + ;; Use SPC (0-9) for digit arguments. + '("1" . meow-digit-argument) + '("2" . meow-digit-argument) + '("3" . meow-digit-argument) + '("4" . meow-digit-argument) + '("5" . meow-digit-argument) + '("6" . meow-digit-argument) + '("7" . meow-digit-argument) + '("8" . meow-digit-argument) + '("9" . meow-digit-argument) + '("0" . meow-digit-argument) + '("/" . meow-keypad-describe-key) + '("?" . meow-cheatsheet)) + (meow-normal-define-key + '("0" . meow-expand-0) + '("9" . meow-expand-9) + '("8" . meow-expand-8) + '("7" . meow-expand-7) + '("6" . meow-expand-6) + '("5" . meow-expand-5) + '("4" . meow-expand-4) + '("3" . meow-expand-3) + '("2" . meow-expand-2) + '("1" . meow-expand-1) + '("-" . negative-argument) + '(";" . meow-reverse) + '("," . meow-inner-of-thing) + '("." . meow-bounds-of-thing) + '("[" . meow-beginning-of-thing) + '("]" . meow-end-of-thing) + '("a" . meow-append) + '("A" . meow-open-below) + '("b" . meow-back-word) + '("B" . meow-back-symbol) + '("c" . meow-change) + '("d" . meow-delete) + '("D" . meow-backward-delete) + '("e" . meow-next-word) + '("E" . meow-next-symbol) + '("f" . meow-find) + '("g" . meow-cancel-selection) + '("G" . meow-grab) + '("h" . meow-left) + '("H" . meow-left-expand) + '("i" . meow-insert) + '("I" . meow-open-above) + '("j" . meow-next) + '("J" . meow-next-expand) + '("k" . meow-prev) + '("K" . meow-prev-expand) + '("l" . meow-right) + '("L" . meow-right-expand) + '("m" . meow-join) + '("n" . meow-search) + '("o" . meow-block) + '("O" . meow-to-block) + '("p" . meow-yank) + '("q" . meow-quit) + '("Q" . meow-goto-line) + '("r" . meow-replace) + '("R" . meow-swap-grab) + '("s" . meow-kill) + '("t" . meow-till) + '("u" . meow-undo) + '("U" . meow-undo-in-selection) + '("v" . meow-visit) + '("w" . meow-mark-word) + '("W" . meow-mark-symbol) + '("x" . meow-line) + '("X" . meow-goto-line) + '("y" . meow-save) + '("Y" . meow-sync-grab) + '("z" . meow-pop-selection) + '("'" . repeat) + '("" . ignore))) +(require 'meow) +(meow-setup) +(meow-global-mode t) +(setq scroll-preserve-screen-position nil) +#+end_src +*** Boon #+begin_src emacs-lisp +(straight-use-package 'boon) +(require 'boon-qwerty) +(boon-mode) +(define-key boon-moves-map "h" 'backward-char) +(define-key boon-moves-map "j" 'next-line) +(define-key boon-moves-map "k" 'previous-line) +(define-key boon-moves-map "l" 'forward-char) +(define-key boon-moves-map "b" 'boon-smarter-backward) +(define-key boon-moves-map "w" 'boon-smarter-forward) +(define-key boon-moves-map ";" '("hop" . avy-goto-char-2)) +(define-key boon-command-map (kbd "C-k") 'scroll-down-line) +(define-key boon-command-map (kbd "C-j") 'scroll-up-line) +;; (define-key boon-command-map (kbd "C-d") 'joe/smooth-scroll-half-page-down) +;; (define-key boon-command-map (kbd "C-u") 'joe/smooth-scroll-half-page-up) +(define-key boon-moves-map "H" 'backward-paragraph) +(define-key boon-moves-map "L" 'forward-paragraph) +(define-key boon-moves-map "K" 'boon-smarter-upward) + +(define-key boon-moves-map "J" 'boon-smarter-downward) + +(define-key boon-moves-map "o" 'boon-open-next-line-and-insert) +(define-key boon-moves-map "O" 'boon-open-next-line-and-insert) + + + + + +#+end_src +*** Evil +#+begin_src emacs-lisp :tangle no (setq evil-want-keybinding nil) (setq evil-undo-system 'undo-fu) @@ -531,9 +658,9 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun (defun joe/window-split-vertical () (interactive) (set 'joe/popper-side-toggle 'right) (rotate:main-horizontal)) (defun joe/window-split-horizontal () (interactive) (set 'joe/popper-side-toggle 'below) (rotate:main-vertical)) -(evil-global-set-key 'normal (kbd "w") 'evil-window-map) +;; (evil-global-set-key 'normal (kbd "w") 'evil-window-map) -(define-key evil-window-map "u" #'winner-undo) +;; (define-key evil-window-map "u" #'winner-undo) (define-key ctl-x-4-map (kbd "|") #'joe/window-split-vertical) (define-key ctl-x-4-map (kbd "-") #'joe/window-split-horizontal) @@ -640,15 +767,15 @@ The theme of `C-x 4` bindings is that they operate on other windows, so this fun (setq tab-bar-mode t) (setq tab-bar-show nil) -(evil-define-key 'normal 'global (kbd "M-1") '(lambda () (interactive) (tab-bar-select-tab 1))) -(evil-define-key 'normal 'global (kbd "M-2") '(lambda () (interactive) (tab-bar-select-tab 2))) -(evil-define-key 'normal 'global (kbd "M-3") '(lambda () (interactive) (tab-bar-select-tab 3))) -(evil-define-key 'normal 'global (kbd "M-4") '(lambda () (interactive) (tab-bar-select-tab 4))) -(evil-define-key 'normal 'global (kbd "M-5") '(lambda () (interactive) (tab-bar-select-tab 5))) -(evil-define-key 'normal 'global (kbd "M-6") '(lambda () (interactive) (tab-bar-select-tab 6))) -(evil-define-key 'normal 'global (kbd "M-7") '(lambda () (interactive) (tab-bar-select-tab 7))) -(evil-define-key 'normal 'global (kbd "M-8") '(lambda () (interactive) (tab-bar-select-tab 8))) -(evil-define-key 'normal 'global (kbd "M-9") '(lambda () (interactive) (tab-bar-select-tab 9))) +;; (evil-define-key 'normal 'global (kbd "M-1") '(lambda () (interactive) (tab-bar-select-tab 1))) +;; (evil-define-key 'normal 'global (kbd "M-2") '(lambda () (interactive) (tab-bar-select-tab 2))) +;; (evil-define-key 'normal 'global (kbd "M-3") '(lambda () (interactive) (tab-bar-select-tab 3))) +;; (evil-define-key 'normal 'global (kbd "M-4") '(lambda () (interactive) (tab-bar-select-tab 4))) +;; (evil-define-key 'normal 'global (kbd "M-5") '(lambda () (interactive) (tab-bar-select-tab 5))) +;; (evil-define-key 'normal 'global (kbd "M-6") '(lambda () (interactive) (tab-bar-select-tab 6))) +;; (evil-define-key 'normal 'global (kbd "M-7") '(lambda () (interactive) (tab-bar-select-tab 7))) +;; (evil-define-key 'normal 'global (kbd "M-8") '(lambda () (interactive) (tab-bar-select-tab 8))) +;; (evil-define-key 'normal 'global (kbd "M-9") '(lambda () (interactive) (tab-bar-select-tab 9))) #+end_src ** Projects #+begin_src emacs-lisp @@ -840,30 +967,30 @@ targets." ("r" "~/Repositories" "Repos") ("B" "~/pCloudDrive/" "pCloud"))) - (evil-define-key 'normal dirvish-mode-map - (kbd "C-c f") #'dirvish-fd - (kbd "a") #'dirvish-quick-access - (kbd ".") #'dired-create-empty-file - (kbd "f") #'dirvish-file-info-menu - (kbd "y") #'dirvish-yank-menu - (kbd "h") #'dired-up-directory - (kbd "l") #'dired-find-file - (kbd "s") #'dirvish-quicksort - (kbd "v") #'dirvish-vc-menu - (kbd "q") #'dirvish-quit - (kbd "L") #'dirvish-history-go-forward - (kbd "H") #'dirvish-history-go-backward - (kbd "o") #'dired-open-file - (kbd "TAB") #'dirvish-subtree-toggle - (kbd "M-n") #'dirvish-narrow - (kbd "M-l") #'dirvish-ls-switches-menu - (kbd "M-m") #'dirvish-mark-menu - (kbd "M-t") #'dirvish-layout-toggle - (kbd "M-s") #'dirvish-setup-menu - (kbd "M-e") #'dirvish-emerge-menu - (kbd "M-j") #'dirvish-fd-jump)) - -(evil-global-set-key 'normal (kbd "-") #'dirvish-dwim) + ;; (evil-define-key 'normal dirvish-mode-map + ;; (kbd "C-c f") #'dirvish-fd + ;; (kbd "a") #'dirvish-quick-access + ;; (kbd ".") #'dired-create-empty-file + ;; (kbd "f") #'dirvish-file-info-menu + ;; (kbd "y") #'dirvish-yank-menu + ;; (kbd "h") #'dired-up-directory + ;; (kbd "l") #'dired-find-file + ;; (kbd "s") #'dirvish-quicksort + ;; (kbd "v") #'dirvish-vc-menu + ;; (kbd "q") #'dirvish-quit + ;; (kbd "L") #'dirvish-history-go-forward + ;; (kbd "H") #'dirvish-history-go-backward + ;; (kbd "o") #'dired-open-file + ;; (kbd "TAB") #'dirvish-subtree-toggle + ;; (kbd "M-n") #'dirvish-narrow + ;; (kbd "M-l") #'dirvish-ls-switches-menu + ;; (kbd "M-m") #'dirvish-mark-menu + ;; (kbd "M-t") #'dirvish-layout-toggle + ;; (kbd "M-s") #'dirvish-setup-menu + ;; (kbd "M-e") #'dirvish-emerge-menu + ;; (kbd "M-j") #'dirvish-fd-jump)) +) +;; (evil-global-set-key 'normal (kbd "-") #'dirvish-dwim) (global-set-key (kbd "C-x d") #'dirvish-dwim) (global-set-key (kbd "C-x C-d") #'joe/dirvish-find-directory) @@ -996,18 +1123,18 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i (setq which-key-idle-delay 0.3) (add-hook 'after-init-hook (lambda () (which-key-mode))) -(which-key-add-keymap-based-replacements evil-normal-state-map - "f" '("Files") - "b" '("Buffers") - "B" '("Bookmarks") - "c" '("Consult") - "d" '("Dired") - "g" '("Git") - "m" '("Make") - "t" '("Tabs") - "p" '("Packages") - "s" '("Shell (vterm)") - "h" '("Help")) +;; (which-key-add-keymap-based-replacements evil-normal-state-map +;; "f" '("Files") +;; "b" '("Buffers") +;; "B" '("Bookmarks") +;; "c" '("Consult") +;; "d" '("Dired") +;; "g" '("Git") +;; "m" '("Make") +;; "t" '("Tabs") +;; "p" '("Packages") +;; "s" '("Shell (vterm)") +;; "h" '("Help")) #+end_src ** IDE Features @@ -1089,11 +1216,11 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i (setq lsp-signature-render-documentation nil) (setq lsp-eldoc-render-all nil) -(evil-global-set-key 'normal (kbd "M-d") #'lsp-describe-thing-at-point) -(evil-global-set-key 'normal (kbd "lh") 'lsp-headerline-breadcrumb-mode) -(evil-global-set-key 'normal (kbd "li") 'lsp-rust-analyzer-inlay-hints-mode) -(evil-global-set-key 'normal (kbd "cs") 'consult-lsp-symbols) -(evil-global-set-key 'normal (kbd "cf") 'consult-lsp-file-symbols) +;; (evil-global-set-key 'normal (kbd "M-d") #'lsp-describe-thing-at-point) +;; (evil-global-set-key 'normal (kbd "lh") 'lsp-headerline-breadcrumb-mode) +;; (evil-global-set-key 'normal (kbd "li") 'lsp-rust-analyzer-inlay-hints-mode) +;; (evil-global-set-key 'normal (kbd "cs") 'consult-lsp-symbols) +;; (evil-global-set-key 'normal (kbd "cf") 'consult-lsp-file-symbols) ;; This function allows us to extract Rust's true function signature (cl-defmethod lsp-clients-extract-signature-on-hover (contents (_server-id (eql rust-analyzer))) @@ -1115,11 +1242,11 @@ startup. Reason we have to call this is so the vterm fucntion can call `vterm--i #+begin_src emacs-lisp (straight-use-package 'flycheck) ;; TODO Add wrapping to these functions -(evil-global-set-key 'normal (kbd "M-e") #'flycheck-next-error) -(evil-global-set-key 'normal (kbd "M-E") #'flycheck-previous-error) -(evil-global-set-key 'normal (kbd "ee") 'flycheck-mode) -(evil-global-set-key 'normal (kbd "el") #'flycheck-list-errors) -(evil-global-set-key 'normal (kbd "ce") #'consult-lsp-diagnostics) +;; (evil-global-set-key 'normal (kbd "M-e") #'flycheck-next-error) +;; (evil-global-set-key 'normal (kbd "M-E") #'flycheck-previous-error) +;; (evil-global-set-key 'normal (kbd "ee") 'flycheck-mode) +;; (evil-global-set-key 'normal (kbd "el") #'flycheck-list-errors) +;; (evil-global-set-key 'normal (kbd "ce") #'consult-lsp-diagnostics) #+end_src *** Compilation #+begin_src emacs-lisp @@ -1224,7 +1351,7 @@ The best git porcelain/client I've ever used. Also kill stray magit buffers left (magit-restore-window-configuration) (mapc #'kill-buffer buffers))) -(add-hook 'with-editor-mode-hook 'evil-insert-state) +;; (add-hook 'with-editor-mode-hook 'evil-insert-state) (setq magit-bury-buffer-function #'joe/magit-kill-buffers) (setq magit-clone-set-remote.pushDefault t)