Created
August 7, 2012 07:48
-
-
Save cabo/3282903 to your computer and use it in GitHub Desktop.
Little helpers for nxml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun cabo:nxml-balanced-close-start-tag-block () | |
"Close the start-tag before point with `>' and insert a balancing end-tag. | |
Point is left between the start-tag and the end-tag. | |
If there is nothing but whitespace before the `<' that opens the | |
start-tag, then put point on a blank line, and put the end-tag on | |
another line aligned with the start-tag." | |
(interactive "*") | |
(nxml-complete) | |
(nxml-balanced-close-start-tag-block)) | |
(defun cabo:nxml-balanced-close-start-tag-inline () | |
"Close the start-tag before point with `>' and insert a balancing end-tag. | |
Point is left between the start-tag and the end-tag. | |
No extra whitespace is inserted." | |
(interactive "*") | |
(nxml-complete) | |
(nxml-balanced-close-start-tag-inline)) | |
(defun bind-nxml-mode-keys () | |
(define-key nxml-mode-map "\C-c\C-b" 'cabo:nxml-balanced-close-start-tag-block) | |
(define-key nxml-mode-map "\C-c\C-i" 'cabo:nxml-balanced-close-start-tag-inline) | |
(define-key nxml-mode-map (kbd "<C-return>") 'completion-at-point)) | |
(add-hook 'nxml-mode-hook 'bind-nxml-mode-keys) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment