Mercurial > vim
comparison runtime/indent/xml.vim @ 3713:9910cbff5f16
Updated runtime files.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 25 Jul 2012 17:49:10 +0200 |
parents | dd6c2497c997 |
children | 63b0b7b79b25 |
comparison
equal
deleted
inserted
replaced
3712:a0b8a8a9867d | 3713:9910cbff5f16 |
---|---|
1 " Language: xml | 1 " Language: xml |
2 " Maintainer: Johannes Zellner <johannes@zellner.org> | 2 " Maintainer: Johannes Zellner <johannes@zellner.org> |
3 " Last Change: 2012 May 18 | 3 " Last Change: 2012 Jul 25 |
4 " Notes: 1) does not indent pure non-xml code (e.g. embedded scripts) | 4 " Notes: 1) does not indent pure non-xml code (e.g. embedded scripts) |
5 " 2) will be confused by unbalanced tags in comments | 5 " 2) will be confused by unbalanced tags in comments |
6 " or CDATA sections. | 6 " or CDATA sections. |
7 " 2009-05-26 patch by Nikolai Weibull | 7 " 2009-05-26 patch by Nikolai Weibull |
8 " TODO: implement pre-like tags, see xml_indent_open / xml_indent_close | 8 " TODO: implement pre-like tags, see xml_indent_open / xml_indent_close |
29 let b:xml_indent_close = '.\{-}</' | 29 let b:xml_indent_close = '.\{-}</' |
30 " end pre tag, e.g. </address> | 30 " end pre tag, e.g. </address> |
31 " let b:xml_indent_close = '.\{-}</\(address\)\@!' | 31 " let b:xml_indent_close = '.\{-}</\(address\)\@!' |
32 endif | 32 endif |
33 | 33 |
34 let &cpo = s:keepcpo | |
35 unlet s:keepcpo | |
36 | |
34 " [-- finish, if the function already exists --] | 37 " [-- finish, if the function already exists --] |
35 if exists('*XmlIndentGet') | finish | endif | 38 if exists('*XmlIndentGet') |
39 finish | |
40 endif | |
41 | |
42 let s:keepcpo= &cpo | |
43 set cpo&vim | |
36 | 44 |
37 fun! <SID>XmlIndentWithPattern(line, pat) | 45 fun! <SID>XmlIndentWithPattern(line, pat) |
38 let s = substitute('x'.a:line, a:pat, "\1", 'g') | 46 let s = substitute('x'.a:line, a:pat, "\1", 'g') |
39 return strlen(substitute(s, "[^\1].*$", '', '')) | 47 return strlen(substitute(s, "[^\1].*$", '', '')) |
40 endfun | 48 endfun |