diff --git a/emacs/init.el b/emacs/init.el index 862e322..36b9c5c 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -540,6 +540,18 @@ Point must be at the beginning of balanced expression (sexp)." (call-interactively #'forward-char) (call-interactively #'paredit-newline)) +(defun cc/slurp-forward () + "Slurps forward when the key is after the closing paren." + (interactive) + (call-interactively #'backward-char) + (call-interactively #'paredit-forward-slurp-sexp)) + +(defun cc/barf-forward () + "Barfs forward even when the key is after the closing paren." + (interactive) + (call-interactively #'backward-char) + (call-interactively #'paredit-forward-barf-sexp)) + (defun looking-at-opening-paren () (looking-at (rx (or "(" "{" "[")))) @@ -570,7 +582,11 @@ Point must be at the beginning of balanced expression (sexp)." (kbd "s") (conditional-keybind #'looking-at-opening-paren #'cc/move-sexp-forward) (kbd "c") (conditional-keybind #'looking-at-opening-paren - #'cc/clone-sexp))) + #'cc/clone-sexp) + (kbd ">") (conditional-keybind #'being-past-closing-paren + #'cc/slurp-forward) + (kbd "<") (conditional-keybind #'being-past-closing-paren + #'cc/barf-forward))) ;; (use-package smartparens ;; :delight (smartparens-mode " 󰅲 ")