1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
## closetag-sanity.diff by James Vega <jamessan@debian.org>
##
## Ensure b:unaryTagsStack is defined whenever GetCloseTag is called.
Index: vim-scripts/macros/closetag.vim
===================================================================
--- vim-scripts.orig/macros/closetag.vim
+++ vim-scripts/macros/closetag.vim
@@ -127,16 +127,6 @@
endif
let loaded_closetag=1
-" if html, don't close certain tags. Works best if ignorecase is set.
-" otherwise, capitalize these elements according to your html editing style
-if !exists("b:unaryTagsStack") || exists("b:closetag_html_style")
- if &filetype == "html" || exists("b:closetag_html_style")
- let b:unaryTagsStack="area base br dd dt hr img input link meta param"
- else " for xsl and xsl
- let b:unaryTagsStack=""
- endif
-endif
-
" set up mappings for tag closing
inoremap <C-_> <C-R>=GetCloseTag()<CR>
map <C-_> a<C-_><ESC>
@@ -226,6 +216,7 @@
" Returns closing tag for most recent unclosed tag, respecting the
" current setting of b:unaryTagsStack for tags that should not be closed
function! GetCloseTag()
+ call s:SanityCheck()
let tag=GetLastOpenTag("b:unaryTagsStack")
if tag == ""
return ""
@@ -234,6 +225,18 @@
endif
endfunction
+function! s:SanityCheck()
+ " if html, don't close certain tags. Works best if ignorecase is set.
+ " otherwise, capitalize these elements according to your html editing style
+ if !exists("b:unaryTagsStack") || exists("b:closetag_html_style")
+ if &filetype == "html" || exists("b:closetag_html_style")
+ let b:unaryTagsStack="area base br dd dt hr img input link meta param"
+ else " for xsl and xsl
+ let b:unaryTagsStack=""
+ endif
+ endif
+endfunction
+
" return 1 if the cursor is in a syntactically identified comment field
" (fails for empty lines: always returns not-in-comment)
function! s:InComment()
|