diff --git a/.config/emacs/init.org b/.config/emacs/init.org index acbcf4f..c274f2f 100644 --- a/.config/emacs/init.org +++ b/.config/emacs/init.org @@ -170,20 +170,18 @@ Finish up (package-install package))) '(recentf benchmark-init - ;; dashboard - ;; ligature ;; hydra - ;; multiple-cursors ;; Text Editing + multiple-cursors evil evil-collection evil-surround - evil-snipe evil-commentary evil-goggles avy all-the-icons-ibuffer drag-stuff + smartparens ;; ace-window ;; Mail smtpmail @@ -192,7 +190,7 @@ Finish up popper ;; VEMCO vertico - vertico-posframe + ;; vertico-posframe savehist embark embark-consult @@ -203,7 +201,6 @@ Finish up consult-eglot consult-lsp lsp-mode - lsp-ui flycheck all-the-icons-completion ;; eat @@ -212,13 +209,13 @@ Finish up helpful vterm doom-modeline + doom-themes undo-fu undo-fu-session vundo which-key mono-complete - beframe - harpoon + ;; harpoon format-all yasnippet consult-yasnippet @@ -228,34 +225,21 @@ Finish up ;; flycheck ;; Org org-bullets - org-kanban org-fancy-priorities org-roam org-download org-transclusion valign ;; Programming Languages + dumb-jump gnuplot - tuareg - dune - merlin - merlin-eldoc - utop highlight-quoted - rustic - ob-rust - haskell-mode clojure-mode cider flycheck-clj-kondo sly - fsharp-mode - go-mode json-mode markdown-mode - typescript-mode - elm-mode - gdscript-mode ;; Tools mu4e-alert dirvish @@ -270,9 +254,7 @@ Finish up (pyenv :url "https://github.com/jorgenschaefer/pyvenv") (time-zones :url "https://github.com/xenodium/time-zones") (nano-calendar :url "https://github.com/rougier/nano-calendar") - (org-timeblock :url "https://github.com/ichernyshovvv/org-timeblock") (dape :url "https://github.com/svaante/dape") - (odin-mode :url "https://github.com/mattt-b/odin-mode") (app-launcher :url "https://github.com/SebastienWae/app-launcher"))) (package-initialize) @@ -366,23 +348,27 @@ Use Dashboard.el. First load `all-the-icons` for nicer rendering #+begin_src emacs-lisp (require 'olivetti) -;; (if (equal "flowjoe-f37" (system-name)) -;; (setq olivetti-minimum-body-width 100) -;; (setq olivetti-minimum-body-width 120)) - -(setq olivetti-minimum-body-width 120) +(setq olivetti-minimum-body-width 160) (global-set-key (kbd "C-x x o") 'olivetti-mode) -;; (add-hook 'prog-mode-hook 'olivetti-mode) -(defun joe/toggle-olivetti-based-on-width () - (when (derived-mode-p 'prog-mode) - (if (> (window-total-width) 440) - (olivetti-mode 1) - (olivetti-mode -1)))) + +(defun joe/toggle-olivetti-based-on-neighbors () + (when (derived-mode-p 'org-mode 'prog-mode) + (if (or (window-in-direction 'left) + (window-in-direction 'right)) + (olivetti-mode -1) + (olivetti-mode 1)))) -(add-hook 'window-configuration-change-hook #'joe/toggle-olivetti-based-on-width) -(remove-hook 'window-configuration-change-hook #'joe/toggle-olivetti-based-on-width) +(add-hook 'window-configuration-change-hook #'joe/toggle-olivetti-based-on-neighbors) + +(defun joe/olivetti-minibuffer () + (setq-local olivetti-minimum-body-width 180) + (olivetti-mode 1)) + +(add-hook 'minibuffer-setup-hook #'joe/olivetti-minibuffer) + +;; (remove-hook 'window-configuration-change-hook #'joe/toggle-olivetti-based-on-neighbors) #+end_src Remove this hook from Olivetti so that lines can truncate [[https://github.com/rnkn/olivetti/issues/76][Github issue]] @@ -640,6 +626,41 @@ Emacs is an great operating system, if only it had a good text editor... (setq-default truncate-lines t) +(defun joe/backward-kill-word-or-kill-region () + (interactive) + (cond + ((use-region-p) + (kill-region (region-beginning) (region-end))) + ((and (boundp 'easy-kill-candidate) + (overlayp easy-kill-candidate) + (overlay-buffer easy-kill-candidate)) + (call-interactively 'easy-kill-region)) + (t + (backward-kill-word 1)))) + +(keymap-global-set "C-w" #'joe/backward-kill-word-or-kill-region) + +(defun joe/kill-region-or-window-management () + (interactive) + (cond + ((and (boundp 'easy-kill-candidate) + (overlayp easy-kill-candidate) + (overlay-buffer easy-kill-candidate)) + (call-interactively 'easy-kill-region)) + (t + (set-transient-map evil-window-map)))) + +(defun joe/backward-delete-word-or-delete-region () + (interactive) + (cond + ((and (boundp 'easy-kill-candidate) + (overlayp easy-kill-candidate) + (overlay-buffer easy-kill-candidate)) + (call-interactively 'easy-kill-delete-region)) + (t + (delete-char 1)))) + +(keymap-global-set "C-d" #'joe/backward-delete-word-or-delete-region) #+end_src Compilation mode hook to recenter the screen after a jump @@ -772,40 +793,18 @@ Fill region is great, except when you don't need it... state)) (evil-define-key 'normal joe/evil-space-mode-map - (kbd "SPC t") tab-prefix-map - (kbd "SPC p") project-prefix-map - (kbd "SPC q") 'kill-buffer-and-window - (kbd "SPC h") 'help-command - (kbd "SPC k") 'kill-current-buffer - (kbd "SPC hf") 'helpful-callable - (kbd "SPC hv") 'helpful-variable - (kbd "SPC hk") 'helpful-key - (kbd "SPC ho") 'helpful-symbol - (kbd "SPC hg") 'helpful-at-point (kbd "SPC fb") 'bookmark-jump (kbd "SPC fr") 'consult-recent-file (kbd "SPC ff") 'project-find-file (kbd "SPC fa") '(lambda () (interactive) (project-find-file t)) (kbd "SPC fi") 'joe/edit-init - (kbd "SPC bl") 'mode-line-other-buffer - (kbd "SPC ba") 'switch-to-buffer - (kbd "SPC bb") 'consult-buffer (kbd "SPC bi") 'ibuffer (kbd "SPC bu") 'recentf-open-most-recent-file (kbd "SPC bm") 'joe/toggle-buffer-mode (kbd "SPC br") 'joe/revert-buffer-no-confirm - (kbd "SPC gg") 'magit-status - (kbd "SPC gc") 'magit-clone - ;; (kbd "SPC ss") 'eat - ;; (kbd "SPC sv") 'eat-other-window (kbd "SPC ss") 'joe/vterm-here (kbd "SPC sv") 'vterm-other-window - (kbd "SPC Ba") 'joe/bookmark-set-and-save - (kbd "SPC Bd") 'bookmark-delete - (kbd "SPC mr") 'joe/compile-run - (kbd "SPC mc") 'joe/compile-comp (kbd "SPC mm") 'mu4e - (kbd "SPC ct") 'joe/consult-theme (kbd "SPC cl") 'consult-line (kbd "SPC ci") 'consult-imenu (kbd "SPC cy") 'consult-yank-from-kill-ring @@ -813,8 +812,8 @@ Fill region is great, except when you don't need it... (kbd "SPC cF") 'consult-find (kbd "SPC co") 'consult-outline) - (define-key evil-window-map "u" #'winner-undo) - (define-key evil-window-map "U" #'winner-redo) +(define-key evil-window-map "u" #'winner-undo) +(define-key evil-window-map "U" #'winner-redo) (defvar joe-mode-map (let ((map (make-sparse-keymap))) @@ -827,21 +826,19 @@ Fill region is great, except when you don't need it... (define-key joe/evil-space-mode-map (kbd "C-'") #'embark-act) (define-key joe/evil-space-mode-map (kbd "C-/") #'comment-line) - (defun joe/scroll-up-line () (interactive) (scroll-up-line 2)) - (defun joe/scroll-down-line () (interactive) (scroll-down-line 2)) - (evil-global-set-key 'normal (kbd "C-e") #'joe/scroll-up-line) - (evil-global-set-key 'normal (kbd "C-y") #'joe/scroll-down-line) - +(defun joe/scroll-up-line () (interactive) (scroll-up-line 2)) +(defun joe/scroll-down-line () (interactive) (scroll-down-line 2)) +(evil-global-set-key 'normal (kbd "C-e") #'joe/scroll-up-line) +(evil-global-set-key 'normal (kbd "C-y") #'joe/scroll-down-line) (require 'evil-collection) (evil-collection-init) +(evil-global-set-key 'visual (kbd "C-w") #'kill-region) +(evil-global-set-key 'normal (kbd "C-w") #'joe/kill-region-or-window-management) (require 'evil-surround) (global-evil-surround-mode t) -(require 'evil-snipe) -(evil-snipe-override-mode +1) - (require 'evil-commentary) (evil-commentary-mode t) @@ -852,7 +849,9 @@ Fill region is great, except when you don't need it... (setq evil-goggles-async-duration 0.55) ;; Recenter lines after mark jump -(advice-add 'evil-goto-mark :after (lambda (&rest _) (evil-scroll-line-to-center (line-number-at-pos)))) +(defun joe/recenter-after-goto-mark () + (recenter)) +(advice-add 'evil-goto-mark :after #'joe/recenter-after-goto-mark) #+end_src *** COMMENT easy-kill #+begin_src emacs-lisp @@ -889,48 +888,6 @@ Fill region is great, except when you don't need it... ;; (add-to-list 'easy-kill-alist '(?$ forward-line-edge "")) ;; (add-to-list 'easy-kill-alist '(?< buffer-before-point "")) ;; (add-to-list 'easy-kill-alist '(?> buffer-after-point "")) -#+end_src -*** Something -#+begin_src emacs-lisp -(defun joe/backward-kill-word-or-kill-region () - (interactive) - (cond - ((use-region-p) - (kill-region (region-beginning) (region-end))) - ((and (boundp 'easy-kill-candidate) - (overlayp easy-kill-candidate) - (overlay-buffer easy-kill-candidate)) - (call-interactively 'easy-kill-region)) - (t - (backward-kill-word 1)))) - -(keymap-global-set "C-w" #'joe/backward-kill-word-or-kill-region) -(evil-global-set-key 'visual (kbd "C-w") #'kill-region) - -(defun joe/kill-region-or-window-management () - (interactive) - (cond - ((and (boundp 'easy-kill-candidate) - (overlayp easy-kill-candidate) - (overlay-buffer easy-kill-candidate)) - (call-interactively 'easy-kill-region)) - (t - (set-transient-map evil-window-map)))) - -(evil-global-set-key 'normal (kbd "C-w") #'joe/kill-region-or-window-management) - -(defun joe/backward-delete-word-or-delete-region () - (interactive) - (cond - ((and (boundp 'easy-kill-candidate) - (overlayp easy-kill-candidate) - (overlay-buffer easy-kill-candidate)) - (call-interactively 'easy-kill-delete-region)) - (t - (delete-char 1)))) - -(keymap-global-set "C-d" #'joe/backward-delete-word-or-delete-region) - #+end_src *** smartparens #+begin_src emacs-lisp @@ -1018,7 +975,7 @@ Fill region is great, except when you don't need it... (global-set-key (kbd "M-e") 'my-text-object-mode) #+end_src -*** COMMENT Multiple Cursors +*** Multiple Cursors #+begin_src emacs-lisp (require 'multiple-cursors) @@ -1038,146 +995,6 @@ Fill region is great, except when you don't need it... ("p" previous-line "line up") ("M-r" move-to-window-line-top-bottom "Reposition cursor")) #+end_src -*** COMMENT Meow -#+begin_src emacs-lisp -(elpaca '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 -*** COMMENT Boon -#+begin_src emacs-lisp -(defun joe/psp-scroll-down-half-page () - (interactive) - (pixel-scroll-precision-scroll-down-page (/ (window-pixel-height) 2))) -(defun joe/psp-scroll-up-half-page () - (interactive) - (pixel-scroll-precision-scroll-up-page (/ (window-pixel-height) 2))) - -(elpaca '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 "q" '("hop" . avy-goto-char-2)) - (define-key boon-command-map (kbd "C-k") #'joe/scroll-down-line) - (define-key boon-command-map (kbd "C-j") #'joe/scroll-up-line) - - (define-key boon-command-map (kbd "C-d") #'joe/psp-scroll-down-half-page) - (define-key boon-command-map (kbd "C-u") #'joe/psp-scroll-up-half-page) - - - (defun joe/scroll-up-line () (interactive) (scroll-up-line 2)) - (defun joe/scroll-down-line () (interactive) (scroll-down-line 2)) - - (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-line-and-insert) - - (define-key boon-moves-map "i" 'boon-set-insert-like-state) - (define-key boon-moves-map "r" 'boon-replace-by-character) - (define-key boon-moves-map "y" 'boon-replace-by-character) - (define-key boon-moves-map "p" 'boon-splice) - (define-key boon-moves-map "y" 'boon-treasure-region) - - (define-key ctl-x-map "s" 'save-buffer)) - -#+end_src ** Buffers #+begin_src emacs-lisp @@ -1345,44 +1162,6 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really (window-parameters (no-delete-other-windows . t))))) -#+end_src -*** Beframe -#+begin_src emacs-lisp -(defvar consult-buffer-sources) -(declare-function consult--buffer-state "consult") - -(with-eval-after-load 'consult - (defface beframe-buffer - '((t :inherit font-lock-string-face)) - "Face for `consult' framed buffers.") - - ;; If you want to filter the current buffer you can use this and replace :items in the - ;; beframe-consult-source var - ;; (defun joe/consult-beframe-names-minus-current () - ;; (delete (buffer-name) (beframe-buffer-names))) -;; :items ,#'joe/consult-beframe-names-minus-current - - (defvar beframe-consult-source - `( :name "Frame-specific buffers (current frame)" - :narrow ?F - :category buffer - :face beframe-buffer - :history beframe-history - :items ,#'beframe-buffer-names - :action ,#'switch-to-buffer - :state ,#'consult--buffer-state)) - - (add-to-list 'consult-buffer-sources 'beframe-consult-source)) -(setq beframe-create-frame-scratch-buffer nil) -(beframe-mode +1) - -(defun joe/beframe-switch-and-unassume () - (interactive) - (let ((curr (current-buffer))) - (mode-line-other-buffer) - (beframe-unassume-current-frame-buffers-selectively (list curr)))) -(evil-global-set-key 'normal (kbd "SPC b f") #'joe/beframe-switch-and-unassume) - #+end_src *** COMMENT Tab-bar & Tab-line #+begin_src emacs-lisp @@ -1517,40 +1296,6 @@ Ace Window will show a hint if there are more than 2 windows, but I don't really "Emacs"))))) (centaur-tabs-mode +1) -#+end_src -*** COMMENT iflipb -#+begin_src emacs-lisp -(global-set-key (kbd "s-n") #'iflipb-next-buffer) -(global-set-key (kbd "s-p") #'iflipb-previous-buffer) -(setq iflipb-permissive-flip-back t) -(setq iflipb-other-buffer-template " %s ") -(setq iflipb-current-buffer-template "<[%s]>") -(setq iflipb-buffer-list-function #'tabspaces--buffer-list) -#+end_src -*** COMMENT Tabspaces -#+begin_src emacs-lisp -(tabspaces-mode +1) - -;; Filter Buffers for Consult-Buffer -(with-eval-after-load 'consult - ;; hide full buffer list (still available with "b" prefix) - (consult-customize consult--source-buffer :hidden t :default nil) - ;; set consult-workspace buffer list - (defvar consult--source-workspace - (list :name "Workspace Buffers" - :narrow ?w - :history 'buffer-name-history - :category 'buffer - :state #'consult--buffer-state - :default t - :items (lambda () (consult--buffer-query - :predicate #'tabspaces--local-buffer-p - :sort 'visibility - :as #'buffer-name))) - - "Set workspace buffer list for consult-buffer.") - (add-to-list 'consult-buffer-sources 'consult--source-workspace)) - #+end_src *** COMMENT Tabs #+begin_src emacs-lisp @@ -1757,26 +1502,26 @@ Stuff to immediately switch to Jetbrains for debugging ;; (setq vertico-posframe-poshandler #'posframe-poshandler-frame-center) (setq vertico-posframe-poshandler #'posframe-poshandler-slightly-below-top) -(defun joe/consult-buffer-vertico-indexed (start-index) - (interactive) - (let ((vertico-count 12) - (vertico-posframe-width 110) - (vertico-posframe-height 20) - (vertico-group-format nil) - (vertico-indexed-start 1) - (vertico--index start-index) - (consult-buffer-sources '(beframe-consult-source))) - (consult-buffer))) +;; (defun joe/consult-buffer-vertico-indexed (start-index) +;; (interactive) +;; (let ((vertico-count 12) +;; (vertico-posframe-width 110) +;; (vertico-posframe-height 20) +;; (vertico-group-format nil) +;; (vertico-indexed-start 1) +;; (vertico--index start-index) +;; (consult-buffer-sources '(beframe-consult-source))) +;; (consult-buffer))) -(defun joe/consult-buffer-vertico-next () - (interactive) - (joe/consult-buffer-vertico-indexed 1)) -(defun joe/consult-buffer-vertico-last () - (interactive) - (joe/consult-buffer-vertico-indexed (1- (length (beframe-buffer-names))))) +;; ;; (defun joe/consult-buffer-vertico-next () +;; (interactive) +;; (joe/consult-buffer-vertico-indexed 1)) +;; (defun joe/consult-buffer-vertico-last () +;; (interactive) +;; (joe/consult-buffer-vertico-indexed (1- (length (beframe-buffer-names))))) -(global-set-key (kbd "s-n") #'joe/consult-buffer-vertico-next) -(global-set-key (kbd "s-p") #'joe/consult-buffer-vertico-last) +;; (global-set-key (kbd "s-n") #'joe/consult-buffer-vertico-next) +;; (global-set-key (kbd "s-p") #'joe/consult-buffer-vertico-last) (setq vertico-count 20 vertico-resize nil @@ -1812,21 +1557,13 @@ Stuff to immediately switch to Jetbrains for debugging (require 'embark) #+end_src -Add a beframe keybinding to unassume a buffer with embark - -#+begin_src emacs-lisp -(define-key embark-buffer-map (kbd "b") #'beframe-unassume-current-frame-buffers-selectively) -#+end_src - These two lines allow you to kill buffers without a confirmation and without closing the mini-buffer so you can quickly kill multiple buffers if needed. The odd looking ~'(t .t)~ is for specifying a default for all other actions. #+begin_src emacs-lisp (setq embark-quit-after-action '((t . t) - (kill-buffer . nil) - ;; (beframe-unassume-current-frame-buffers-selectively . nil))) - (joe/beframe-unassume-and-refresh-consult . nil))) + (kill-buffer . nil))) (setf (alist-get 'kill-buffer embark-pre-action-hooks) nil) #+end_src @@ -2352,7 +2089,7 @@ These help speed eglot up apparently [[https://www.reddit.com/r/emacs/comments/1 (setq lsp-signature-auto-activate nil) (setq lsp-eldoc-enable-hover nil) (setq eldoc-echo-area-use-multiline-p 'truncate-sym-name-if-fit) -(setq eldoc-idle-delay 0) +(setq eldoc-idle-delay 0.2) (setq lsp-eldoc-render-all t) ;; (setq lsp-ui-doc-enable t) (defun joe/lsp-mode-hook () @@ -2361,12 +2098,12 @@ These help speed eglot up apparently [[https://www.reddit.com/r/emacs/comments/1 (define-key global-map (kbd "C-c l l") #'lsp) -(setq lsp-ui-doc-position 'at-point) -(setq lsp-ui-doc-show-with-mouse nil) +;; (setq lsp-ui-doc-position 'at-point) +;; (setq lsp-ui-doc-show-with-mouse nil) ;; All this changes because we are using eglot now (when (boundp 'evil-mode) - (evil-global-set-key 'normal (kbd "M-d") #'lsp-ui-doc-glance) + (evil-global-set-key 'normal (kbd "M-d") #'eldoc-doc-buffer) (evil-global-set-key 'normal (kbd "M-D") #'lsp-describe-thing-at-point) (evil-global-set-key 'normal (kbd "M-r") #'lsp-rename) (evil-global-set-key 'insert (kbd "M-i") #'lsp-signature-activate) @@ -2413,19 +2150,17 @@ newly opened buffer belongs to an LSP session and if it does, start lsp (defun joe/flycheck-buffer-and-next () (interactive) (flycheck-buffer) (flycheck-next-error)) (defun joe/flycheck-buffer-and-previous () (interactive) (flycheck-buffer) (flycheck-previous-error)) -(defun joe/flycheck-clear () - (interactive) - (when (boundp 'lsp-ui-mode) - (flycheck-clear) - (lsp-ui-sideline--erase))) +(defun joe/flycheck-clear-if-active () + (when (bound-and-true-p flycheck-mode) + (flycheck-clear))) -(add-hook 'after-save-hook #'joe/flycheck-clear) +(add-hook 'after-save-hook #'joe/flycheck-clear-if-active) (when (boundp 'evil-mode) (evil-global-set-key 'normal (kbd "M-E") #'joe/flycheck-buffer-and-previous) (evil-global-set-key 'normal (kbd "M-e") #'joe/flycheck-buffer-and-next) - (evil-global-set-key 'normal (kbd "C-M-e") #'joe/flycheck-clear) - (evil-global-set-key 'insert (kbd "C-M-e") #'joe/flycheck-clear)) + (evil-global-set-key 'normal (kbd "C-M-e") #'joe/flycheck-clear-if-active) + (evil-global-set-key 'insert (kbd "C-M-e") #'joe/flycheck-clear-if-active)) #+end_src *** Compilation #+begin_src emacs-lisp @@ -2474,10 +2209,6 @@ newly opened buffer belongs to an LSP session and if it does, start lsp (popper-close-latest)))))) (add-hook 'compilation-finish-functions 'joe/close-compilation-if-no-warn-err) #+end_src -*** Godot -#+begin_src emacs-lisp -(require 'gdscript-mode) -#+end_src *** Indentation #+begin_src emacs-lisp (setq indent-bars-color '(highlight :face-bg t :blend 0.1)) @@ -2682,50 +2413,6 @@ it doesn't close it. (define-key inferior-python-mode-map (kbd "C-n") #'comint-next-input) (define-key inferior-python-mode-map (kbd "C-p") #'comint-previous-input) #+end_src -*** Rust -#+begin_src emacs-lisp -;; (setq rustic-lsp-setup-p nil) -;; (require 'rustic) -;; (require 'ob-rust) -;; Org-Babel -;; Disabling until we figure out how to get it working -;; (elpaca 'parsec) ;; Required by evcxr-mode - -;; (elpaca -;; '(evcxr -;; :type git -;; :host github -;; :repo "serialdev/evcxr-mode")) - -(defun joe/save-then-rustic-cargo-check () - "Save the buffer before recompiling" - (interactive) - (when (buffer-file-name) - (save-buffer)) - (rustic-cargo-check)) - -(add-hook 'rust-mode-hook - (lambda () - ;; (evcxr-minor-mode) - (electric-pair-local-mode) - (yas-minor-mode) - (define-key rustic-mode-map (kbd "") #'joe/save-then-rustic-cargo-check) - (define-key rustic-cargo-run-mode-map (kbd "") #'joe/save-then-rustic-cargo-check) - (define-key rustic-mode-map (kbd "") #'joe/save-then-recompile))) - -;; (with-eval-after-load 'rustic -;; ;; Don't autostart -;; ;; (define-key rustic-mode-map (kbd "") #'joe/save-then-recompile) - -;; (setq lsp-rust-analyzer-server-display-inlay-hints t) -;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-enable "always") -;; (setq lsp-rust-analyzer-display-chaining-hints t) -;; (setq lsp-rust-analyzer-display-lifetime-elision-hints-use-parameter-names t) -;; (setq lsp-rust-analyzer-display-closure-return-type-hints t) -;; (setq lsp-rust-analyzer-display-parameter-hints t) -;; (setq lsp-rust-analyzer-display-reborrow-hints t) -;; (setq lsp-rust-analyzer-cargo-watch-command "clippy")) -#+end_src *** Common Lisp #+begin_src emacs-lisp (setq inferior-lisp-program "/usr/local/bin/sbcl") @@ -2749,11 +2436,6 @@ it doesn't close it. (insert string) (forward-char -1)))) -#+end_src -*** Web -#+begin_src emacs-lisp -(require 'typescript-mode) -(setq typescript-indent-level 2) #+end_src *** SQL #+begin_src emacs-lisp @@ -2823,25 +2505,6 @@ it doesn't close it. (comint-send-string proc "\\set ECHO queries\n")))) (add-hook 'sql-login-hook 'joe/sql-login-hook) -#+end_src -*** Odin -#+begin_src emacs-lisp -(with-eval-after-load 'lsp-mode - (setq-default lsp-auto-guess-root t) ;; Helps find the ols.json file with Projectile or project.el - (setq lsp-language-id-configuration (cons '(odin-mode . "odin") lsp-language-id-configuration)) - - (lsp-register-client - (make-lsp-client :new-connection (lsp-stdio-connection "~/.local/bin/ols") ;; Adjust the path here - :major-modes '(odin-mode) - :server-id 'ols - :multi-root t))) ;; Ensures lsp-mode sends "workspaceFolders" to the server - -;; (add-hook 'odin-mode-hook #'lsp) - -(defun joe/odin-mode-hook () - (electric-pair-local-mode)) -(add-hook 'odin-mode-hook #'joe/odin-mode-hook) - #+end_src *** CSharp @@ -2861,121 +2524,12 @@ And we do the rest here, including a macro (lsp))) (add-hook 'csharp-mode-hook #'joe/csharp-mode-hook) #+end_src -*** COMMENT OCaml -#+begin_src emacs-lisp -(require 'tuareg) -(require 'dune) -(require 'utop) -;; (require 'merlin) -;; (require 'merlin-eldoc) -;; Might be worth checking out, depeding on whether we stick with flycheck or not -;; (elpaca 'flycheck-ocaml) -;; Also check this out, see if it adds anything -;; (require 'ocp-indent) - -(defun opam-env () - "Load the opam env to get the PATH variables so everything works" - (interactive nil) - (dolist (var - (car (read-from-string - (shell-command-to-string "opam config env --sexp")))) - (setenv (car var) (cadr var)))) -(setq opam-share - (substring (shell-command-to-string - "opam config var share 2> /dev/null") 0 -1)) -(add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share)) -(add-to-list 'exec-path "/home/joe/.opam/default/bin/") -#+end_src - -We won't use the LSP server but rather directly talk to Merlin, since I guess LSP just wraps Merlin -and there's no need for a middle-man when it's already been implemented. - -#+begin_src emacs-lisp - -;; (require 'utop) -;; Use the opam installed utop -(setq utop-command "opam exec -- utop -emacs") - -(let ((opam-share (ignore-errors (car (process-lines "opam" "var" "share"))))) - (when (and opam-share (file-directory-p opam-share)) - ;; Register Merlin - (add-to-list 'load-path (expand-file-name "emacs/site-lisp" opam-share)) - (autoload 'merlin-mode "merlin" nil t nil) - ;; Automatically start it in OCaml buffers - (add-hook 'tuareg-mode-hook 'merlin-mode t) - (add-hook 'caml-mode-hook 'merlin-mode t) - ;; Use opam switch to lookup ocamlmerlin binary - (setq merlin-command 'opam))) -#+end_src -*** COMMENT Haskell -#+begin_src emacs-lisp - (require 'haskell-mode) - (setq haskell-interactive-popup-errors nil) - - (evil-define-key 'insert haskell-interactive-mode-map (kbd "C-n") #'haskell-interactive-mode-history-next) - (evil-define-key 'insert haskell-interactive-mode-map (kbd "C-p") #'haskell-interactive-mode-history-previous) - -#+end_src -*** COMMENT FSharp -#+begin_src emacs-lisp -(require 'fsharp-mode) -;; (elpaca 'eglot-fsharp) - -#+end_src -*** COMMENT Go - -#+begin_src emacs-lisp -(require 'go-mode) -;; (elpaca 'go-imports) -#+end_src *** Other #+begin_src emacs-lisp (require 'json-mode) (require 'markdown-mode) #+end_src ** Debugging -*** COMMENT DAP -#+begin_src emacs-lisp -(require 'dap-mode) -;; (setq dap-auto-configure-features '(locals breakpoints expressions tooltip)) - -(require 'dap-cpptools) -(dap-cpptools-setup) -(add-hook 'dap-stopped-hook - (lambda (arg) (call-interactively #'dap-hydra))) - -(setq dap-cpptools-extension-version "1.12.1") - -(setq dap-default-terminal-kind "integrated") -(dap-auto-configure-mode +1) -(dap-register-debug-template - "Rust::CppTools Run Configuration" - (list :type "cppdbg" - :request "launch" - :name "Rust::Run" - :MIMode "gdb" - :miDebuggerPath "rust-gdb" - :environment [] - :program "${workspaceFolder}/target/debug/kanban-tui" - :cwd "${workspaceFolder}" - :console "external" - :dap-compilation "cargo build" - :dap-compilation-dir "${workspaceFolder}")) -#+end_src -*** COMMENT GDB/GUD -#+begin_src emacs-lisp -(setq gdb-many-windows t) -(setq gud-tooltip-dereference t) - -(defun joe/gdb () - (interactive) - (gdb (format "%s -i=mi" (file-name-sans-extension buffer-file-name)))) - -(defun hook-gud-mode () - (define-key gud-global-map (kbd "C-c") #'gud-cont) - (define-key gud-global-map (kbd "C-r") #'gud-run)) -(add-hook 'gud-mode-hook #'hook-gud-mode) -#+end_src *** dape #+begin_src emacs-lisp (setq dape-buffer-window-arrangement 'right) @@ -3001,6 +2555,8 @@ Apparently this helps with the performance of dape, as well as LSP (setq org-directory "~/Notes/") (evil-define-key 'normal calendar-mode-map (kbd "RET") #'org-calendar-select) +(define-key org-mode-map (kbd "M-g i") #'consult-outline) + ;; This is for org-clock-report (setq org-duration-format 'h:mm) #+end_src @@ -3267,43 +2823,16 @@ with the cursor you hit TAB and you complete the following; (define-key global-map (kbd "C-c n c") #'org-roam-capture) (org-roam-setup) #+end_src -*** COMMENT org-kanban -#+begin_src emacs-lisp -(require 'org-kanban) -#+end_src ** Calendar - #+begin_src emacs-lisp -(require 'calfw) -(setq cfw:fchar-junction ?╋ - cfw:fchar-vertical-line ?┃ - cfw:fchar-horizontal-line ?━ - cfw:fchar-left-junction ?┣ - cfw:fchar-right-junction ?┫ - cfw:fchar-top-junction ?┯ - cfw:fchar-top-left-corner ?┏ - cfw:fchar-top-right-corner ?┓) -#+end_src - -#+begin_src emacs-lisp -(require 'cl) -(require 'calendar) - -(defun twelve-month-calendar () +(defun joe/nano-calendar () (interactive) - (let ((calendar-buffer (get-buffer-create "12-month calendar")) - (month 12) - (year 2012)) - (set-buffer calendar-buffer) - (setq calendar-frame (make-frame)) - (make-variable-buffer-local 'font-lock-face) - (set-face-attribute 'default calendar-frame :height 70) - (set-frame-width calendar-frame 300) - (erase-buffer) - (dotimes (i 12) - (calendar-generate-month month year 0) - (calendar-increment-month month year -1)) - (calendar-mode))) + (nano-calendar) + (with-current-buffer "*nano-calendar*" + (text-scale-set 2) + (evil-emacs-state))) + +(evil-global-set-key 'normal (kbd "SPC cc") #'joe/nano-calendar) #+end_src ** Magit @@ -3333,12 +2862,13 @@ The best git porcelain/client I've ever used. Also kill stray magit buffers left (magit-status))) (evil-define-key 'normal joe/evil-space-mode-map (kbd "SPC g h") #'joe/magit-status-here) +(evil-define-key 'normal joe/evil-space-mode-map (kbd "SPC g f") #'magit-find-file) ;; (define-key magit-mode-map "h" 'backward-char) ;; (define-key magit-mode-map "l" 'backward-char) #+end_src -;; TODO: We need to create a var for a project based base branch +TODO: We need to create a var for a project based base branch #+begin_src emacs-lisp (defun joe/magit-diff-branch-changes () @@ -3379,7 +2909,6 @@ The best git porcelain/client I've ever used. Also kill stray magit buffers left #+begin_src emacs-lisp (load-file "/home/joe/.config/emacs/elisp/welcome.el") #+end_src - * COMMENT Local variables ;; Local Variables: ;; eval: (add-hook 'after-save-hook '(lambda () (org-babel-tangle)) nil t)