Replace meow, puni, vterm -> god-mode, lispy, eat
This commit is contained in:
parent
b0840f4c9c
commit
32e0abfb3f
286
init.el
286
init.el
|
@ -48,147 +48,58 @@
|
|||
(use-package undo-fu
|
||||
:demand t
|
||||
:config
|
||||
(global-unset-key (kbd "C-z"))
|
||||
(global-set-key (kbd "C-z") #'undo-fu-only-undo)
|
||||
(global-set-key (kbd "C-S-z") #'undo-fu-only-redo))
|
||||
(global-unset-key (kbd "C-/"))
|
||||
(global-unset-key (kbd "C-?"))
|
||||
(global-set-key (kbd "C-/") #'undo-fu-only-undo)
|
||||
(global-set-key (kbd "C-?") #'undo-fu-only-redo))
|
||||
|
||||
(cl-defun my-meow-undo (arg)
|
||||
"Uses undo-fu to undo, but cancels region first unless negative prefix."
|
||||
(interactive "*p")
|
||||
(let ((undo-fu-allow-undo-in-region t))
|
||||
(pcase (cons (< arg 0) (region-active-p))
|
||||
('(t . t) (setq arg (abs arg)))
|
||||
('(t . nil) (cl-return-from my-meow-undo))
|
||||
('(nil . t) (setq undo-fu-allow-undo-in-region nil)))
|
||||
(undo-fu-only-undo arg)))
|
||||
(defun my-meow-forward-paragraph ()
|
||||
(interactive)
|
||||
(meow--execute-kbd-macro "M-}"))
|
||||
(defun my-meow-backward-paragraph ()
|
||||
(interactive)
|
||||
(meow--execute-kbd-macro "M-{"))
|
||||
|
||||
(use-package meow
|
||||
(use-package god-mode
|
||||
:demand t
|
||||
:bind
|
||||
("<escape>" . god-mode-all)
|
||||
("C-S-h" . help-command)
|
||||
("C-h" . (lambda () (interactive) (meow--execute-kbd-macro "DEL")))
|
||||
("C-h" . my--god-del)
|
||||
(:map god-local-mode-map
|
||||
("i" . god-mode-all)
|
||||
("<escape>" . my--god-c-g)
|
||||
("z" . repeat)
|
||||
("q" . my--god-c-q))
|
||||
(:map minibuffer-local-map
|
||||
("<escape>" . abort-minibuffers))
|
||||
:custom
|
||||
(god-exempt-major-modes nil)
|
||||
(god-exempt-predicates nil)
|
||||
(god-mode-enable-function-key-translations nil)
|
||||
:config
|
||||
(setq meow-cheatsheet-layout meow-cheatsheet-layout-qwerty)
|
||||
(meow-motion-overwrite-define-key '("j" . meow-next)
|
||||
'("k" . meow-prev)
|
||||
'("<escape>" . ignore))
|
||||
(meow-leader-define-key '("j" . "H-j")
|
||||
'("k" . "H-k")
|
||||
'("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)
|
||||
'("(" . insert-pair)
|
||||
'("[" . insert-pair)
|
||||
'("{" . insert-pair)
|
||||
'("<" . insert-pair)
|
||||
'("yy" . meow-clipboard-save)
|
||||
'("ys" . meow-clipboard-kill)
|
||||
'("yp" . meow-clipboard-yank))
|
||||
(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)
|
||||
'("F" . meow-find-expand)
|
||||
'("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)
|
||||
'("N" . meow-pop-search)
|
||||
'("o" . meow-block)
|
||||
'("O" . meow-to-block)
|
||||
'("p" . meow-yank)
|
||||
'("q" . meow-quit)
|
||||
'("r" . meow-replace)
|
||||
'("R" . meow-swap-grab)
|
||||
'("s" . meow-kill)
|
||||
'("t" . meow-till)
|
||||
'("T" . meow-till-expand)
|
||||
'("u" . my-meow-undo)
|
||||
'("U" . undo-fu-only-redo)
|
||||
'("v" . meow-page-down)
|
||||
'("V" . meow-page-up)
|
||||
'("w" . meow-mark-word)
|
||||
'("W" . meow-mark-symbol)
|
||||
'("x" . meow-line)
|
||||
'("X" . meow-find-ref)
|
||||
'("y" . meow-save)
|
||||
'("Y" . meow-sync-grab)
|
||||
'("z" . meow-pop-selection)
|
||||
'("Z" . meow-goto-line)
|
||||
'("'" . repeat)
|
||||
'("/" . meow-visit)
|
||||
'(">" . meow-forward-slurp)
|
||||
'("<" . meow-forward-barf)
|
||||
'("C-<" . meow-backward-slurp)
|
||||
'("C->" . meow-backward-barf)
|
||||
'("}" . my-meow-forward-paragraph)
|
||||
'("{" . my-meow-backward-paragraph)
|
||||
'(":" . meow-comment)
|
||||
'("=" . meow-indent)
|
||||
'("<escape>" . ignore))
|
||||
(god-mode)
|
||||
(defun my--god-c-q ()
|
||||
(interactive)
|
||||
(let ((god-local-mode nil))
|
||||
(if-let* ((buffer-read-only)
|
||||
(ret (key-binding (read-kbd-macro "q")))
|
||||
((not (or (eq ret #'self-insert-command) (and (boundp lispy-mode) lispy-mode)))))
|
||||
(call-interactively ret)
|
||||
(switch-to-prev-buffer))))
|
||||
(cl-macrolet ((define-kmacro-wrapper (name key)
|
||||
`(defun ,name ()
|
||||
(interactive)
|
||||
(call-interactively (key-binding (read-kbd-macro ,key))))))
|
||||
(define-kmacro-wrapper my--god-del "DEL")
|
||||
(define-kmacro-wrapper my--god-c-g "C-g"))
|
||||
(with-eval-after-load 'catppuccin-theme
|
||||
(setq meow-cursor-type-insert 'box)
|
||||
(face-spec-set 'meow-insert-cursor `((t (:background
|
||||
,(catppuccin-get-color 'mauve)
|
||||
:inherit
|
||||
unspecified))))
|
||||
(face-spec-set 'meow-unknown-cursor `((t (:background
|
||||
,(catppuccin-get-color 'rosewater)
|
||||
:inherit
|
||||
unspecified))))
|
||||
(dolist (meow-cursor-face '(meow-normal-cursor meow-motion-cursor meow-beacon-cursor))
|
||||
(face-spec-set meow-cursor-face '((t (:inherit meow-unknown-cursor)))))
|
||||
(add-to-list 'meow-update-cursor-functions-alist
|
||||
(cons (lambda () (and (meow-insert-mode-p) (not (display-graphic-p))))
|
||||
(lambda () (meow--set-cursor-type '(hbar 2))))))
|
||||
(meow-global-mode))
|
||||
(add-hook 'god-mode-enabled-hook
|
||||
(lambda ()
|
||||
(if (display-graphic-p)
|
||||
(set-cursor-color (catppuccin-get-color 'rosewater))
|
||||
(send-string-to-terminal "\e[2 q"))))
|
||||
(add-hook 'god-mode-disabled-hook
|
||||
(lambda ()
|
||||
(if (display-graphic-p)
|
||||
(set-cursor-color (catppuccin-get-color 'mauve))
|
||||
;; Escape codes for hbar cursor in insert mode
|
||||
(send-string-to-terminal "\e[4 q")))))
|
||||
(unless (or (daemonp) (display-graphic-p))
|
||||
(keymap-global-set "C-l" (lambda () (interactive) (god-mode-all 0)))))
|
||||
|
||||
(use-package avy
|
||||
:bind
|
||||
|
@ -199,37 +110,22 @@
|
|||
("M-g w" . avy-goto-word-1)
|
||||
("M-g e" . avy-goto-word-0)
|
||||
:custom
|
||||
(avy-timeout-seconds 0.3)
|
||||
:init
|
||||
(with-eval-after-load 'meow
|
||||
(meow-normal-define-key '("?" . avy-goto-char-timer))))
|
||||
(avy-timeout-seconds 0.3))
|
||||
|
||||
(use-package puni
|
||||
:hook prog-mode tex-mode sly-mrepl-mode racket-repl-mode
|
||||
:bind (:map puni-mode-map
|
||||
("C-)" . puni-slurp-forward)
|
||||
("C-}" . puni-barf-forward)
|
||||
("C-(" . puni-slurp-backward)
|
||||
("C-{" . puni-barf-backward)
|
||||
("C-c p t" . puni-transpose)
|
||||
("C-c p r" . puni-raise)
|
||||
("C-c p C-s" . puni-splice)
|
||||
("C-c p s" . puni-split)
|
||||
("C-c p z" . puni-squeeze))
|
||||
(use-package lispy
|
||||
:hook
|
||||
emacs-lisp-mode
|
||||
ielm-mode
|
||||
lisp-mode
|
||||
scheme-mode
|
||||
clojure-mode
|
||||
sly-mrepl-mode
|
||||
racket-repl-mode
|
||||
:config
|
||||
(with-eval-after-load 'goggles
|
||||
(defun my--disable-goggles-for-puni (oldfun &rest r)
|
||||
(let ((old-goggles-mode goggles-mode))
|
||||
(goggles-mode 0)
|
||||
(prog1 (apply oldfun r)
|
||||
(when old-goggles-mode
|
||||
(goggles-mode)))))
|
||||
(dolist (fun '(puni-slurp-forward
|
||||
puni-barf-forward
|
||||
puni-slurp-backward
|
||||
puni-barf-backward
|
||||
puni-raise))
|
||||
(advice-add fun :around #'my--disable-goggles-for-puni))))
|
||||
(add-to-list 'lispy-compat 'god-mode)
|
||||
(add-to-list 'lispy-compat 'magit-blame-mode)
|
||||
(when (boundp 'god-local-mode-map)
|
||||
(push (assoc 'god-local-mode minor-mode-map-alist) minor-mode-map-alist)))
|
||||
|
||||
(use-package ace-window
|
||||
:bind ("C-c w" . ace-window)
|
||||
|
@ -310,15 +206,9 @@
|
|||
emacs-lisp-mode
|
||||
ielm-mode
|
||||
lisp-mode
|
||||
lisp-interaction-mode
|
||||
scheme-mode
|
||||
clojure-mode
|
||||
nix-mode
|
||||
:config
|
||||
(with-eval-after-load 'meow
|
||||
(setq aggressive-indent-protected-commands
|
||||
(append aggressive-indent-protected-commands
|
||||
'(my-meow-undo meow-undo meow-undo-in-selection)))))
|
||||
nix-mode)
|
||||
|
||||
(use-package rainbow-delimiters
|
||||
:hook prog-mode sly-mrepl-mode racket-repl-mode)
|
||||
|
@ -335,7 +225,9 @@
|
|||
:custom
|
||||
(which-key-idle-delay 0.2)
|
||||
:config
|
||||
(which-key-mode))
|
||||
(which-key-mode)
|
||||
(with-eval-after-load 'god-mode
|
||||
(which-key-enable-god-mode-support)))
|
||||
|
||||
(use-package flymake
|
||||
:ensure nil
|
||||
|
@ -446,9 +338,7 @@
|
|||
(list (current-local-map)))
|
||||
(setq-local corfu-echo-display nil
|
||||
corfu-popupinfo-delay nil)
|
||||
(corfu-mode))))
|
||||
(with-eval-after-load 'meow
|
||||
(add-hook 'meow-insert-exit-hook #'corfu-quit)))
|
||||
(corfu-mode)))))
|
||||
|
||||
(use-package cape)
|
||||
|
||||
|
@ -719,39 +609,14 @@
|
|||
vc-ignore-dir-regexp
|
||||
tramp-file-name-regexp)))
|
||||
|
||||
(use-package vterm
|
||||
(use-package eat
|
||||
:bind
|
||||
("C-c t" . vterm)
|
||||
("C-c T" . vterm-other-window)
|
||||
:hook (vterm-mode . my-inhibit-hl-line-mode)
|
||||
("C-c t" . eat)
|
||||
(:map eat-mode-map
|
||||
("<escape>" . eat-self-input))
|
||||
:config
|
||||
(with-eval-after-load 'meow
|
||||
(defvar meow-vterm-normal-mode-map
|
||||
(let ((map (make-sparse-keymap)))
|
||||
(define-key map (kbd "RET") #'vterm-send-return)
|
||||
map))
|
||||
(setq vterm-keymap-exceptions '("C-c"))
|
||||
(define-key vterm-mode-map (kbd "C-c ESC") #'vterm-send-escape)
|
||||
(dolist (c '((yank . vterm-yank)
|
||||
(xterm-paste . vterm-xterm-paste)
|
||||
(yank-pop . vterm-yank-pop)
|
||||
(mouse-yank-primary . vterm-yank-primary)
|
||||
(self-insert-command . vterm--self-insert)
|
||||
(beginning-of-defun . vterm-previous-prompt)
|
||||
(end-of-defun . vterm-next-prompt)))
|
||||
(define-key meow-vterm-normal-mode-map (vector 'remap (car c)) (cdr c)))
|
||||
(add-hook 'vterm-mode-hook
|
||||
(lambda ()
|
||||
(add-hook 'meow-insert-enter-hook
|
||||
(lambda ()
|
||||
(use-local-map vterm-mode-map)
|
||||
(vterm-goto-char (point)))
|
||||
nil t)
|
||||
(add-hook 'meow-insert-exit-hook
|
||||
(lambda ()
|
||||
(use-local-map meow-vterm-normal-mode-map))
|
||||
nil t)))
|
||||
(add-to-list 'meow-mode-state-list '(vterm-mode . insert))))
|
||||
(with-eval-after-load 'god-mode
|
||||
(add-to-list 'god-exempt-predicates (lambda () eat-terminal))))
|
||||
|
||||
(use-package circe
|
||||
:hook (circe-channel-mode . enable-lui-autopaste)
|
||||
|
@ -861,8 +726,7 @@
|
|||
:hook
|
||||
(shell-mode . with-editor-export-editor)
|
||||
(eshell-mode . with-editor-export-editor)
|
||||
(term-exec . with-editor-export-editor)
|
||||
(vterm-mode . with-editor-export-editor))
|
||||
(term-exec . with-editor-export-editor))
|
||||
|
||||
(use-package nyan-mode
|
||||
:custom
|
||||
|
@ -940,9 +804,7 @@
|
|||
(smtpmail-smtp-user . ,address)))))
|
||||
my--agenix-email-json-data)))
|
||||
(when (fboundp 'imagemagick-register-types)
|
||||
(imagemagick-register-types))
|
||||
(with-eval-after-load 'meow
|
||||
(add-to-list 'meow-mode-state-list '(mu4e-view-mode . motion))))
|
||||
(imagemagick-register-types)))
|
||||
|
||||
(use-package org-msg
|
||||
:after message
|
||||
|
@ -1091,7 +953,7 @@
|
|||
|
||||
(setq auto-mode-alist
|
||||
(append '(("\\.yuck\\'" . lisp-mode)
|
||||
("flake\\.lock\\'" . js-json-mode))
|
||||
("/flake\\.lock\\'" . js-json-mode))
|
||||
auto-mode-alist
|
||||
'(("/qutebrowser-editor-" . text-mode))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue