Browse files

while prompting for tag, exit minibuffer when '>' is typed

  • Loading branch information...
1 parent b4110d3 commit 9492f4b65975b68983829d16b60ed65f6fa7e1a1 @timcharper committed Jul 24, 2010
Showing with 8 additions and 2 deletions.
  1. +8 −2 vimpulse-surround.el
View
10 vimpulse-surround.el
@@ -45,7 +45,8 @@
("}" . ("{" . "}"))
("{" . ("{ " . " }"))
("#" . ("#{" . "}"))
- ("t" . 'vimpulse-surround-read-tag))
+ ("t" . 'vimpulse-surround-read-tag)
+ ("<" . 'vimpulse-surround-read-tag))
"Alist of surround items.
Each item is of the form (TRIGGER . (LEFT . RIGHT)), all strings.
This only affects inserting pairs, not deleting or changing them."
@@ -67,8 +68,13 @@ It triggers `vimpulse-change'. Nothing to see here, move along.")
(defvar *vimpulse-surround-start-size* nil)
(defvar *vimpulse-surround-end-size* nil)
+(defvar vimpulse-surround-read-tag-keymap
+ (let ((map (copy-keymap minibuffer-local-map)))
+ (define-key map ">" 'exit-minibuffer)
+ map))
+
(defun vimpulse-surround-read-tag ()
- (let* ((input (read-from-minibuffer "<"))
+ (let* ((input (read-from-minibuffer "<" "" vimpulse-surround-read-tag-keymap))
(_ (string-match "\\([a-z-]+\\)\\(.*?\\)[>]*$" input))
(tag (match-string 1 input))
(rest (match-string 2 input)))

0 comments on commit 9492f4b

Please sign in to comment.