Add wrap-region and modify expand-region to match
This commit is contained in:
parent
1b12caa6b8
commit
710dfe7cd5
18
init.el
18
init.el
|
@ -944,7 +944,10 @@ See also `crux-reopen-as-root-mode'."
|
||||||
(exec-path-from-shell-initialize))
|
(exec-path-from-shell-initialize))
|
||||||
|
|
||||||
(setup (:straight expand-region)
|
(setup (:straight expand-region)
|
||||||
(:+key "C-=" #'er/expand-region))
|
(:also-load +expand-region)
|
||||||
|
(:option expand-region-fast-keys-enabled nil)
|
||||||
|
(:+key "C-=" #'er/expand-region
|
||||||
|
"C--" #'+er/contract-or-negative-argument))
|
||||||
|
|
||||||
(setup (:straight (fill-sentences-correctly
|
(setup (:straight (fill-sentences-correctly
|
||||||
:host github
|
:host github
|
||||||
|
@ -1303,6 +1306,19 @@ See also `crux-reopen-as-root-mode'."
|
||||||
whitespace-cleanup-mode-only-if-initially-clean nil)
|
whitespace-cleanup-mode-only-if-initially-clean nil)
|
||||||
(global-whitespace-cleanup-mode +1))
|
(global-whitespace-cleanup-mode +1))
|
||||||
|
|
||||||
|
(setup (:straight wrap-region)
|
||||||
|
(:require wrap-region)
|
||||||
|
(wrap-region-add-wrappers
|
||||||
|
'(("*" "*" nil org-mode)
|
||||||
|
("~" "~" nil org-mode)
|
||||||
|
("/" "/" nil org-mode)
|
||||||
|
("=" "=" nil org-mode)
|
||||||
|
("+" "+" nil org-mode)
|
||||||
|
("_" "_" nil org-mode)
|
||||||
|
("$" "$" nil (org-mode latex-mode))))
|
||||||
|
(:hook-into org-mode
|
||||||
|
latex-mode))
|
||||||
|
|
||||||
(setup (:straight zoom-frm))
|
(setup (:straight zoom-frm))
|
||||||
|
|
||||||
(setup (:straight zzz-to-char)
|
(setup (:straight zzz-to-char)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
;;; +expand-region.el -*- lexical-binding: t; -*-
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
;; Because of `wrap-region', I can't use `expand-region-fast-keys-enabled'. So
|
||||||
|
;; instead of that, I'm adding this to the binding to C--, but I also want to be
|
||||||
|
;; able to use the negative argument. So there's this.
|
||||||
|
(defun +er/contract-or-negative-argument (arg)
|
||||||
|
"Contract the region if the last command expanded it.
|
||||||
|
Otherwise, pass the ARG as a negative argument."
|
||||||
|
(interactive "p")
|
||||||
|
(cond ((memq last-command '(er/expand-region
|
||||||
|
er/contract-region
|
||||||
|
+er/contract-or-negative-argument))
|
||||||
|
|
||||||
|
(er/contract-region arg))
|
||||||
|
(t (call-interactively #'negative-argument))))
|
||||||
|
|
||||||
|
(provide '+expand-region)
|
||||||
|
;;; +expand-region.el ends here
|
Loading…
Reference in New Issue