Rework u/U negative argument configuration for Meow

This commit is contained in:
eriedaberrie 2023-04-08 22:46:40 -07:00
parent 9389b50b1f
commit 90e4eb03b4

22
init.el
View file

@ -48,15 +48,15 @@
(global-set-key (kbd "C-z") #'undo-fu-only-undo)
(global-set-key (kbd "C-S-z") #'undo-fu-only-redo))
(defun my-meow-undo (arg)
"Same as meow-undo, but uses undo-fu to redo if negative prefix."
(interactive "P")
(when (region-active-p)
(meow--cancel-selection))
(let ((numeric-prefix (prefix-numeric-value arg)))
(if (meow--with-negative-argument-p arg)
(undo-fu-only-redo (abs numeric-prefix))
(undo-fu-only-undo numeric-prefix))))
(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-}"))
@ -146,7 +146,7 @@
'("s" . meow-kill)
'("t" . meow-till)
'("u" . my-meow-undo)
'("U" . meow-undo-in-selection)
'("U" . undo-fu-only-redo)
'("v" . meow-page-down)
'("V" . meow-page-up)
'("w" . meow-mark-word)
@ -179,7 +179,7 @@
: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)))))
(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))))))