summaryrefslogtreecommitdiff
path: root/evil-surround.el
diff options
context:
space:
mode:
authorBrian Leung <leungbk@posteo.net>2022-01-02 16:33:07 -0800
committerBrian Leung <leungbk@posteo.net>2022-01-02 19:45:47 -0800
commit191ad92fb89a4eb80ef2c130a64889eb1bb676c2 (patch)
tree232628a363b825e1dc5506835bf39439f783fc66 /evil-surround.el
parent282a975bda83310d20a2c536ac3cf95d2bf188a5 (diff)
Add support for surrounding with function calls in prefix form
Diffstat (limited to 'evil-surround.el')
-rw-r--r--evil-surround.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/evil-surround.el b/evil-surround.el
index 26cf211..3cdd262 100644
--- a/evil-surround.el
+++ b/evil-surround.el
@@ -64,6 +64,7 @@
(?> . ("<" . ">"))
(?t . evil-surround-read-tag)
(?< . evil-surround-read-tag)
+ (?\C-f . evil-surround-prefix-function)
(?f . evil-surround-function))
"Association list of surround items.
Each item is of the form (TRIGGER . (LEFT . RIGHT)), all strings.
@@ -132,6 +133,13 @@ Each item is of the form (OPERATOR . OPERATION)."
(cons (format "%s(" (or fname ""))
")")))
+(defun evil-surround-prefix-function ()
+ "Read a function name from the minibuffer and wrap selection in a
+function call in prefixed form."
+ (let ((fname (evil-surround-read-from-minibuffer "prefix function: " "")))
+ (cons (format "(%s " (or fname ""))
+ ")")))
+
(defconst evil-surround-tag-name-re "\\([0-9a-zA-Z\.-]+\\)"
"Regexp matching an XML tag name.")