summaryrefslogtreecommitdiff
path: root/evil-surround.el
diff options
context:
space:
mode:
authorTom Dalziel <33435574+tomdl89@users.noreply.github.com>2022-04-12 19:24:43 +0200
committerGitHub <noreply@github.com>2022-04-12 19:24:43 +0200
commit2bc8aa6425f1311e985cf51ea6b5233c1ee6ce1c (patch)
tree172ed799d76a629e8880c7273eb36c0f74827138 /evil-surround.el
parent648da3c544cbb0e03b81295c07aeecac2f5bf221 (diff)
parent191ad92fb89a4eb80ef2c130a64889eb1bb676c2 (diff)
Merge pull request #186 from leungbk/prefix-calls
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 942e252..e20e0cd 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.")