Improve multiple-frame cursor and in-terminal handling for god-mode

This commit is contained in:
eriedaberrie 2023-11-09 10:10:13 -08:00
parent 57e3ef6e47
commit 7541c3e54f

18
init.el
View file

@ -57,15 +57,18 @@
:demand t :demand t
:bind :bind
("<escape>" . god-mode-all) ("<escape>" . god-mode-all)
("ESC ESC ESC" . god-mode-all)
("C-S-h" . help-command) ("C-S-h" . help-command)
("C-h" . my--god-del) ("C-h" . my--god-del)
(:map god-local-mode-map (:map god-local-mode-map
("i" . god-mode-all) ("i" . god-mode-all)
("<escape>" . my--god-c-g) ("<escape>" . my--god-c-g)
("ESC ESC ESC" . keyboard-escape-quit)
("z" . repeat) ("z" . repeat)
("q" . my--god-c-q)) ("q" . my--god-c-q))
(:map minibuffer-local-map (:map minibuffer-local-map
("<escape>" . abort-minibuffers)) ("<escape>" . abort-minibuffers)
("ESC ESC ESC" . keyboard-escape-quit))
:custom :custom
(god-exempt-major-modes nil) (god-exempt-major-modes nil)
(god-exempt-predicates (list #'god-exempt-mode-p)) (god-exempt-predicates (list #'god-exempt-mode-p))
@ -88,17 +91,15 @@
(with-eval-after-load 'catppuccin-theme (with-eval-after-load 'catppuccin-theme
(add-hook 'god-mode-enabled-hook (add-hook 'god-mode-enabled-hook
(lambda () (lambda ()
(if (display-graphic-p) (face-spec-set 'cursor `((t (:background ,(catppuccin-get-color 'rosewater)))))
(set-cursor-color (catppuccin-get-color 'rosewater)) (unless (display-graphic-p)
(send-string-to-terminal "\e[2 q")))) (send-string-to-terminal "\e[2 q"))))
(add-hook 'god-mode-disabled-hook (add-hook 'god-mode-disabled-hook
(lambda () (lambda ()
(if (display-graphic-p) (face-spec-set 'cursor `((t (:background ,(catppuccin-get-color 'mauve)))))
(set-cursor-color (catppuccin-get-color 'mauve)) (unless (display-graphic-p)
;; Escape codes for hbar cursor in insert mode ;; Escape codes for hbar cursor in insert mode
(send-string-to-terminal "\e[4 q"))))) (send-string-to-terminal "\e[4 q")))))
(unless (or (daemonp) (display-graphic-p))
(keymap-global-set "C-l" (lambda () (interactive) (god-mode-all 0))))
(god-mode)) (god-mode))
(use-package multiple-cursors (use-package multiple-cursors
@ -148,8 +149,6 @@
lisp-mode lisp-mode
scheme-mode scheme-mode
clojure-mode clojure-mode
sly-mrepl-mode
racket-repl-mode
:config :config
(add-to-list 'lispy-compat 'god-mode) (add-to-list 'lispy-compat 'god-mode)
(add-to-list 'lispy-compat 'magit-blame-mode) (add-to-list 'lispy-compat 'magit-blame-mode)
@ -660,6 +659,7 @@
("C-c t" . eat) ("C-c t" . eat)
(:map eat-mode-map (:map eat-mode-map
("<escape>" . eat-self-input)) ("<escape>" . eat-self-input))
:hook (eat-mode . my-inhibit-hl-line-mode)
:config :config
(with-eval-after-load 'god-mode (with-eval-after-load 'god-mode
(add-to-list 'god-exempt-major-modes 'eat-mode))) (add-to-list 'god-exempt-major-modes 'eat-mode)))