Use sp-{for,back}ward-sexp wrappers instead of sp-{beginning,end}-of-sexp

This commit is contained in:
David Morgan 2023-06-19 13:08:56 +01:00
parent 408d6f1bed
commit 361056268e
Signed by: djm
GPG Key ID: C171251002C200F2
1 changed files with 12 additions and 4 deletions

View File

@ -74,12 +74,24 @@ Equivalent to raising then wrapping."
nil t)
(apply origin args)))
(advice-add 'sp-mark-sexp :around 'sp-mark-sexp-advice)
(defun sp-fwd-sexp (arg)
(interactive "^P")
(if (sp--raw-argument-p arg)
(sp-end-of-sexp)
(call-interactively 'sp-forward-sexp arg)))
(defun sp-bwd-sexp (arg)
(interactive "^P")
(if (sp--raw-argument-p arg)
(sp-beginning-of-sexp)
(call-interactively 'sp-backward-sexp arg)))
(unbind-key "M-?" 'smartparens-mode-map)
(unbind-key "M-?" 'sp-keymap)
:bind (:map smartparens-mode-map
("C-M-?" . sp-convolute-sexp)
([remap mark-sexp] . sp-mark-sexp)
([remap kill-sexp] . sp-kill-sexp)
([remap sp-forward-sexp] . sp-fwd-sexp)
([remap sp-backward-sexp] . sp-bwd-sexp)
("M-[" . sp-wrap-square)
("C-c M-{" . sp-wrap-curly)
("M-W" . sp-copy-sexp)
@ -90,10 +102,6 @@ Equivalent to raising then wrapping."
("M-;" . paredit-comment-dwim)
("M-q" . sp-indent-defun)
("C-j" . sp-newline)
("C-S-a" . sp-beginning-of-sexp)
("M-A" . sp-beginning-of-sexp)
("C-S-e" . sp-end-of-sexp)
("M-E" . sp-end-of-sexp)
("M-R" . kill-around-sexp)
("C-c C-S-d" . duplicate-sexp-after-point)
("C-c M-(" . wrap-round-from-behind)))