Update runtime files.

This commit is contained in:
Bram Moolenaar
2019-03-24 15:09:13 +01:00
parent db77b84ac2
commit 63b74a8362
21 changed files with 343 additions and 143 deletions

View File

@ -1,7 +1,12 @@
" Vim indent file
" Language: cobol
" Author: Tim Pope <vimNOSPAM@tpope.info>
" Maintainer: Ankit Jain <ajatkj@yahoo.co.in>
" (formerly Tim Pope <vimNOSPAM@tpope.info>)
" $Id: cobol.vim,v 1.1 2007/05/05 18:08:19 vimboss Exp $
" Last Update: By Ankit Jain on 22.03.2019
" Ankit Jain 22.03.2019 Changes & fixes:
" Allow chars in 1st 6 columns
" #C22032019
if exists("b:did_indent")
finish
@ -66,7 +71,9 @@ function! GetCobolIndent(lnum) abort
let ashft = minshft + 1
let bshft = ashft + 4
" (Obsolete) numbered lines
if getline(a:lnum) =~? '^\s*\d\{6\}\%($\|[ */$CD-]\)'
" #C22032019: Columns 1-6 could have alphabets as well as numbers
"if getline(a:lnum) =~? '^\s*\d\{6\}\%($\|[ */$CD-]\)'
if getline(a:lnum) =~? '^\s*[a-zA-Z0-9]\{6\}\%($\|[ */$CD-]\)'
return 0
endif
let cline = s:stripped(a:lnum)

View File

@ -2,7 +2,7 @@
" Header: "{{{
" Maintainer: Bram Moolenaar
" Original Author: Andy Wokula <anwoku@yahoo.de>
" Last Change: 2018 Mar 28
" Last Change: 2019 Mar 20
" Version: 1.0
" Description: HTML indent script with cached state for faster indenting on a
" range of lines.
@ -902,12 +902,19 @@ func! s:InsideTag(foundHtmlString)
"{{{
if a:foundHtmlString
" Inside an attribute string.
" Align with the previous line or use an external function.
" Align with the opening quote or use an external function.
let lnum = v:lnum - 1
if lnum > 1
if exists('b:html_indent_tag_string_func')
return b:html_indent_tag_string_func(lnum)
endif
" If there is a double quote in the previous line, indent with the
" character after it.
if getline(lnum) =~ '"'
call cursor(lnum, 0)
normal f"
return virtcol('.')
endif
return indent(lnum)
endif
endif

View File

@ -7,6 +7,8 @@
" License: Vim (see :h license)
" Repository: https://github.com/chrisbra/vim-sh-indent
" Changelog:
" 20190316 - Make use of searchpairpos for nested if sections
" fixes #11
" 20190201 - Better check for closing if sections
" 20180724 - make check for zsh syntax more rigid (needs word-boundaries)
" 20180326 - better support for line continuation
@ -115,7 +117,7 @@ function! GetShIndent()
" Current line is a endif line, so get indent from start of "if condition" line
" TODO: should we do the same for other "end" lines?
if curline =~ '^\s*\%(fi\)\s*\%(#.*\)\=$'
let previous_line = search('if.\{-\};\s*then\s*\%(#.*\)\=$', 'bnW')
let previous_line = searchpair('\<if\>', '', '\<fi\>', 'bnW')
if previous_line > 0
let ind = indent(previous_line)
endif

View File

@ -82,9 +82,9 @@ RUNNING THE TEST
Before running the test, create a FILETYPE.ok file. You can leave it empty at
first.
Now run "make test". After Vim has done the indenting you will see a
FILETYPE.fail file. This contains the actual result of indenting, and it's
different from the FILETYPE.ok file.
Now run "make test" from the parent directory. After Vim has done the
indenting you will see a FILETYPE.fail file. This contains the actual result
of indenting, and it's different from the FILETYPE.ok file.
Check the contents of the FILETYPE.fail file. If it is perfectly OK, then
rename it to overwrite the FILETYPE.ok file. If you now run "make test" again,

View File

@ -9,17 +9,17 @@
</div>
<div
class="foo bar">
class="foo bar">
text
</div>
<div class="foo bar"
data="something">
data="something">
text
</div>
<div class="foo
bar">
bar">
text
</div>

View File

@ -7,6 +7,7 @@ if 1
set nocp
filetype indent on
syn on
set nowrapscan
set report=9999
@ -111,7 +112,6 @@ for fname in glob('testdir/*.in', 1, 1)
if failed
exe 'write ' . root . '.fail'
echoerr 'Test ' . fname . ' FAILED!'
sleep 2
else
exe 'write ' . root . '.out'
endif

View File

@ -10,11 +10,11 @@
<!-- text comment -->
<!--
text comment
text comment
-->
</tag1>
<!--
text comment
text comment
end coment -->
</tag0>
<!-- END_INDENT -->

View File

@ -1,9 +1,11 @@
" Language: xml
" Repository: https://github.com/chrisbra/vim-xml-ftplugin
" Last Changed: Jan 28, 2019
" Last Changed: Feb 04, 2019
" Maintainer: Christian Brabandt <cb@256bit.org>
" Previous Maintainer: Johannes Zellner <johannes@zellner.org>
" Last Change:
" 20190204 - correctly handle wrap tags
" https://github.com/chrisbra/vim-xml-ftplugin/issues/5
" 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
@ -74,13 +76,20 @@ fun! <SID>XmlIndentSynCheck(lnum)
endfun
" [-- return the sum of indents of a:lnum --]
fun! <SID>XmlIndentSum(lnum, style, add)
let line = getline(a:lnum)
if a:style == match(line, '^\s*</')
fun! <SID>XmlIndentSum(line, style, add)
if <SID>IsXMLContinuation(a:line) && a:style == 0
" no complete tag, add one additional indent level
" but only for the current line
return a:add + shiftwidth()
elseif <SID>HasNoTagEnd(a:line)
" no complete tag, return initial indent
return a:add
endif
if a:style == match(a:line, '^\s*</')
return (shiftwidth() *
\ (<SID>XmlIndentWithPattern(line, b:xml_indent_open)
\ - <SID>XmlIndentWithPattern(line, b:xml_indent_close)
\ - <SID>XmlIndentWithPattern(line, '.\{-}/>'))) + a:add
\ (<SID>XmlIndentWithPattern(a:line, b:xml_indent_open)
\ - <SID>XmlIndentWithPattern(a:line, b:xml_indent_close)
\ - <SID>XmlIndentWithPattern(a:line, '.\{-}/>'))) + a:add
else
return a:add
endif
@ -89,19 +98,24 @@ endfun
" Main indent function
fun! XmlIndentGet(lnum, use_syntax_check)
" Find a non-empty line above the current line.
let plnum = prevnonblank(a:lnum - 1)
" Hit the start of the file, use zero indent.
if plnum == 0
if prevnonblank(a:lnum - 1) == 0
" Hit the start of the file, use zero indent.
return 0
endif
" Find previous line with a tag (regardless whether open or closed,
" but always start restrict the match to a line before the current one
" Note: xml declaration: <?xml version="1.0"?>
" won't be found, as it is not a legal tag name
let ptag_pattern = '\%(.\{-}<[/:A-Z_a-z]\)'. '\%(\&\%<'. line('.').'l\)'
let ptag = search(ptag_pattern, 'bnw')
let ptag = search(ptag_pattern, 'bnW')
" no previous tag
if ptag == 0
return 0
endif
let syn_name = ''
if a:use_syntax_check
let check_lnum = <SID>XmlIndentSynCheck(plnum)
let check_lnum = <SID>XmlIndentSynCheck(ptag)
let check_alnum = <SID>XmlIndentSynCheck(a:lnum)
if check_lnum == 0 || check_alnum == 0
return indent(a:lnum)
@ -113,18 +127,31 @@ fun! XmlIndentGet(lnum, use_syntax_check)
return <SID>XmlIndentComment(a:lnum)
endif
let pline = getline(ptag)
let pind = indent(ptag)
" Get indent from previous tag line
let ind = <SID>XmlIndentSum(ptag, -1, indent(ptag))
let ind = <SID>XmlIndentSum(pline, -1, pind)
let t_ind = ind
" Determine indent from current line
let ind = <SID>XmlIndentSum(a:lnum, 0, ind)
let ind = <SID>XmlIndentSum(getline(a:lnum), 0, ind)
return ind
endfun
func! <SID>IsXMLContinuation(line)
" Checks, whether or not the line matches a start-of-tag
return a:line !~ '^\s*<'
endfunc
func! <SID>HasNoTagEnd(line)
" Checks whether or not the line matches '>' (so finishes a tag)
return a:line !~ '>\s*$'
endfunc
" return indent for a commented line,
" the middle part might be indented on additional level
func! <SID>XmlIndentComment(lnum)
let ptagopen = search(b:xml_indent_open, 'bnw')
let ptagclose = search(b:xml_indent_close, 'bnw')
let ptagopen = search(b:xml_indent_open, 'bnW')
let ptagclose = search(b:xml_indent_close, 'bnW')
if getline(a:lnum) =~ '<!--'
" if previous tag was a closing tag, do not add
" one additional level of indent
@ -136,10 +163,10 @@ func! <SID>XmlIndentComment(lnum)
endif
elseif getline(a:lnum) =~ '-->'
" end of comment, same as start of comment
return indent(search('<!--', 'bnw'))
return indent(search('<!--', 'bnW'))
else
" middle part of comment, add one additional level
return indent(search('<!--', 'bnw')) + shiftwidth()
return indent(search('<!--', 'bnW')) + shiftwidth()
endif
endfunc