aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent/xml.vim
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-07-29 03:16:37 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-07-29 20:50:07 +0200
commit57fa9add79faa1c34d71bf19f1c0cd0380059954 (patch)
treeb88ccea250e9234a4eb4c57a0f7f24ef6c3f6938 /runtime/indent/xml.vim
parentb5cb6c743afea565a2586490fc5a5b151ddbbfbb (diff)
downloadrneovim-57fa9add79faa1c34d71bf19f1c0cd0380059954.tar.gz
rneovim-57fa9add79faa1c34d71bf19f1c0cd0380059954.tar.bz2
rneovim-57fa9add79faa1c34d71bf19f1c0cd0380059954.zip
vim-patch:314dd79cac2a
Update runtime files. https://github.com/vim/vim/commit/314dd79cac2adc10304212d1980d23ecf6782cfc
Diffstat (limited to 'runtime/indent/xml.vim')
-rw-r--r--runtime/indent/xml.vim13
1 files changed, 8 insertions, 5 deletions
diff --git a/runtime/indent/xml.vim b/runtime/indent/xml.vim
index bc64aacfe1..29069bab84 100644
--- a/runtime/indent/xml.vim
+++ b/runtime/indent/xml.vim
@@ -1,9 +1,11 @@
" Language: xml
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
-" Last Changed: Dec 07th, 2018
+" Last Changed: Jan 28, 2019
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change:
+" 20190128 - Make sure to find previous tag
+" https://github.com/chrisbra/vim-xml-ftplugin/issues/4
" 20181116 - Fix indentation when tags start with a colon or an underscore
" https://github.com/vim/vim/pull/926
" 20181022 - Do not overwrite indentkeys setting
@@ -88,15 +90,16 @@ endfun
fun! XmlIndentGet(lnum, use_syntax_check)
" Find a non-empty line above the current line.
let plnum = prevnonblank(a:lnum - 1)
- " Find previous line with a tag (regardless whether open or closed)
- let ptag = search('.\{-}<[/:A-Z_a-z]', 'bnw')
-
" Hit the start of the file, use zero indent.
if plnum == 0
return 0
endif
- let syn_name = ''
+ " Find previous line with a tag (regardless whether open or closed,
+ " but always start restrict the match to a line before the current one
+ let ptag_pattern = '\%(.\{-}<[/:A-Z_a-z]\)'. '\%(\&\%<'. line('.').'l\)'
+ let ptag = search(ptag_pattern, 'bnw')
+ let syn_name = ''
if a:use_syntax_check
let check_lnum = <SID>XmlIndentSynCheck(plnum)
let check_alnum = <SID>XmlIndentSynCheck(a:lnum)