Skip to content

Commit

Permalink
while prompting for tag, exit minibuffer when '>' is typed
Browse files Browse the repository at this point in the history
  • Loading branch information
timcharper committed Jul 24, 2010
1 parent b4110d3 commit 9492f4b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions vimpulse-surround.el
Expand Up @@ -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."
Expand All @@ -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)))
Expand Down

0 comments on commit 9492f4b

Please sign in to comment.