From 2eae5db069dc171f74cd863487655f6a88e5384d Mon Sep 17 00:00:00 2001 From: Mehmet Samet Duman Date: Fri, 3 Apr 2026 22:21:25 +0300 Subject: NOISSUE rebrand vim to MNV's not Vim Signed-off-by: Mehmet Samet Duman --- uvim/runtime/autoload/xmlformat.vim | 211 ------------------------------------ 1 file changed, 211 deletions(-) delete mode 100644 uvim/runtime/autoload/xmlformat.vim (limited to 'uvim/runtime/autoload/xmlformat.vim') diff --git a/uvim/runtime/autoload/xmlformat.vim b/uvim/runtime/autoload/xmlformat.vim deleted file mode 100644 index c541e65755..0000000000 --- a/uvim/runtime/autoload/xmlformat.vim +++ /dev/null @@ -1,211 +0,0 @@ -" Vim plugin for formatting XML -" Last Change: 2023 March 15th -" Version: 0.3 -" Author: Christian Brabandt -" Repository: https://github.com/chrisbra/vim-xml-ftplugin -" License: VIM License -" Documentation: see :h xmlformat.txt (TODO!) -" --------------------------------------------------------------------- -" Load Once: {{{1 -if exists("g:loaded_xmlformat") || &cp - finish -endif -let g:loaded_xmlformat = 1 -let s:keepcpo = &cpo -set cpo&vim - -" Main function: Format the input {{{1 -func! xmlformat#Format() abort - " only allow reformatting through the gq command - " (e.g. Vim is in normal mode) - if mode() != 'n' - " do not fall back to internal formatting - return 0 - endif - let count_orig = v:count - let sw = shiftwidth() - let prev = prevnonblank(v:lnum-1) - let s:indent = indent(prev)/sw - let result = [] - let lastitem = prev ? getline(prev) : '' - let is_xml_decl = 0 - " go through every line, but don't join all content together and join it - " back. We might lose empty lines - let list = getline(v:lnum, (v:lnum + count_orig - 1)) - let current = 0 - for line in list - " Keep empty input lines? - if empty(line) - call add(result, '') - let current += 1 - continue - elseif line !~# '<[/]\?[^>]*>' - let nextmatch = match(list, '^\s*$\|<[/]\?[^>]*>', current) - if nextmatch > -1 - let lineEnd = nextmatch - else - let lineEnd = len(list) - endif - let line .= ' '. join(list[(current + 1):(lineEnd-1)], " ") - call remove(list, current+1, lineEnd-1) - endif - " split on `>`, but don't split on very first opening < - " this means, items can be like ['', 'tag content'] - for item in split(line, '.\@<=[>]\zs') - if s:EndTag(item) - call s:DecreaseIndent() - call add(result, s:Indent(item)) - elseif s:EmptyTag(lastitem) - call add(result, s:Indent(item)) - elseif s:StartTag(lastitem) && s:IsTag(item) - let s:indent += 1 - call add(result, s:Indent(item)) - else - if !s:IsTag(item) - " Simply split on '<', if there is one, - " but reformat according to &textwidth - let t=split(item, '.<\@=\zs') - - " if the content fits well within a single line, add it there - " so that the output looks like this: - " - " 1 - if s:TagContent(lastitem) is# s:TagContent(t[1]) && strlen(result[-1]) + strlen(item) <= s:Textwidth() - let result[-1] .= item - let lastitem = t[1] - continue - endif - " t should only contain 2 items, but just be safe here - if s:IsTag(lastitem) - let s:indent+=1 - endif - let result+=s:FormatContent([t[0]]) - if s:EndTag(t[1]) - call s:DecreaseIndent() - endif - let result+=s:FormatContent(t[1:]) - if s:IsTag(t[1]) - let lastitem = t[1] - continue - endif - elseif s:IsComment(item) - let result+=s:FormatContent([item]) - else - call add(result, s:Indent(item)) - endif - endif - let lastitem = item - endfor - let current += 1 - endfor - - if !empty(result) - let lastprevline = getline(v:lnum + count_orig) - let delete_lastline = v:lnum + count_orig - 1 == line('$') - exe 'silent ' .. v:lnum. ",". (v:lnum + count_orig - 1). 'd' - call append(v:lnum - 1, result) - " Might need to remove the last line, if it became empty because of the - " append() call - let last = v:lnum + len(result) - " do not use empty(), it returns true for `empty(0)` - if getline(last) is '' && lastprevline is '' && delete_lastline - exe last. 'd' - endif - endif - - " do not run internal formatter! - return 0 -endfunc -" Check if given tag is XML Declaration header {{{1 -func! s:IsXMLDecl(tag) abort - return a:tag =~? '^\s*\s*$' -endfunc -" Return tag indented by current level {{{1 -func! s:Indent(item) abort - return repeat(' ', shiftwidth()*s:indent). s:Trim(a:item) -endfu -" Return item trimmed from leading whitespace {{{1 -func! s:Trim(item) abort - if exists('*trim') - return trim(a:item) - else - return matchstr(a:item, '\S\+.*') - endif -endfunc -" Check if tag is a new opening tag {{{1 -func! s:StartTag(tag) abort - let is_comment = s:IsComment(a:tag) - return a:tag =~? '^\s*<[^/?]' && !is_comment -endfunc -" Check if tag is a Comment start {{{1 -func! s:IsComment(tag) abort - return a:tag =~? '