aboutsummaryrefslogtreecommitdiff
path: root/runtime/indent
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-28 08:39:30 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-28 21:29:57 -0400
commit565783be4b42ec8cf2d24543b7d501499c6a1091 (patch)
tree1f80eb628fdc0aa84d75d765e7830a8cf5114f44 /runtime/indent
parent04a4bbbe56fd6cbc164730cb9beab4ec6fefe3b0 (diff)
downloadrneovim-565783be4b42ec8cf2d24543b7d501499c6a1091.tar.gz
rneovim-565783be4b42ec8cf2d24543b7d501499c6a1091.tar.bz2
rneovim-565783be4b42ec8cf2d24543b7d501499c6a1091.zip
vim-patch:acc224064033
Update runtime files https://github.com/vim/vim/commit/acc224064033e5cea21ef7f1eefb356ca06ff11d Omit 'quickfixtextfunc'. Omit ftplugin/man.vim.
Diffstat (limited to 'runtime/indent')
-rw-r--r--runtime/indent/sqlanywhere.vim80
-rw-r--r--runtime/indent/testdir/yaml.in5
-rw-r--r--runtime/indent/testdir/yaml.ok5
-rw-r--r--runtime/indent/yaml.vim11
4 files changed, 59 insertions, 42 deletions
diff --git a/runtime/indent/sqlanywhere.vim b/runtime/indent/sqlanywhere.vim
index ba35d76715..601c567adc 100644
--- a/runtime/indent/sqlanywhere.vim
+++ b/runtime/indent/sqlanywhere.vim
@@ -1,7 +1,8 @@
" Vim indent file
" Language: SQL
" Maintainer: David Fishburn <dfishburn dot vim at gmail dot com>
-" Last Change: 2017 Jun 13
+" Last Change By Maintainer: 2017 Jun 13
+" Last Change: by Stephen Wall, #5578, 2020 Jun 07
" Version: 3.0
" Download: http://vim.sourceforge.net/script.php?script_id=495
@@ -67,68 +68,73 @@ set cpo&vim
" IS is excluded, since it is difficult to determine when the
" ending block is (especially for procedures/functions).
let s:SQLBlockStart = '^\s*\%('.
- \ 'if\|else\|elseif\|elsif\|'.
- \ 'while\|loop\|do\|for\|'.
- \ 'begin\|'.
+ \ 'if\>.*\<then\|'.
+ \ 'then\|else\>\|'.
+ \ 'elseif\>.*\<then\|'.
+ \ 'elsif\>.(\<then\|'.
+ \ 'while\>.*\<loop\|'.
+ \ 'for\>.*\<loop\|'.
+ \ 'foreach\>.*\<loop\|'.
+ \ 'loop\|do\|declare\|begin\|'.
\ 'case\|when\|merge\|exception'.
\ '\)\>'
let s:SQLBlockEnd = '^\s*\(end\)\>'
-" The indent level is also based on unmatched paranethesis
+" The indent level is also based on unmatched parentheses
" If a line has an extra "(" increase the indent
" If a line has an extra ")" decrease the indent
-function! s:CountUnbalancedParan( line, paran_to_check )
+function! s:CountUnbalancedParen( line, paren_to_check )
let l = a:line
let lp = substitute(l, '[^(]', '', 'g')
let l = a:line
let rp = substitute(l, '[^)]', '', 'g')
- if a:paran_to_check =~ ')'
- " echom 'CountUnbalancedParan ) returning: ' .
+ if a:paren_to_check =~ ')'
+ " echom 'CountUnbalancedParen ) returning: ' .
" \ (strlen(rp) - strlen(lp))
return (strlen(rp) - strlen(lp))
- elseif a:paran_to_check =~ '('
- " echom 'CountUnbalancedParan ( returning: ' .
+ elseif a:paren_to_check =~ '('
+ " echom 'CountUnbalancedParen ( returning: ' .
" \ (strlen(lp) - strlen(rp))
return (strlen(lp) - strlen(rp))
else
- " echom 'CountUnbalancedParan unknown paran to check: ' .
- " \ a:paran_to_check
+ " echom 'CountUnbalancedParen unknown paren to check: ' .
+ " \ a:paren_to_check
return 0
endif
endfunction
" Unindent commands based on previous indent level
-function! s:CheckToIgnoreRightParan( prev_lnum, num_levels )
+function! s:CheckToIgnoreRightParen( prev_lnum, num_levels )
let lnum = a:prev_lnum
let line = getline(lnum)
let ends = 0
- let num_right_paran = a:num_levels
- let ignore_paran = 0
+ let num_right_paren = a:num_levels
+ let ignore_paren = 0
let vircol = 1
- while num_right_paran > 0
+ while num_right_paren > 0
silent! exec 'norm! '.lnum."G\<bar>".vircol."\<bar>"
- let right_paran = search( ')', 'W' )
- if right_paran != lnum
+ let right_paren = search( ')', 'W' )
+ if right_paren != lnum
" This should not happen since there should be at least
- " num_right_paran matches for this line
+ " num_right_paren matches for this line
break
endif
let vircol = virtcol(".")
" if getline(".") =~ '^)'
- let matching_paran = searchpair('(', '', ')', 'bW',
+ let matching_paren = searchpair('(', '', ')', 'bW',
\ 's:IsColComment(line("."), col("."))')
- if matching_paran < 1
+ if matching_paren < 1
" No match found
" echom 'CTIRP - no match found, ignoring'
break
endif
- if matching_paran == lnum
- " This was not an unmatched parantenses, start the search again
+ if matching_paren == lnum
+ " This was not an unmatched parentheses, start the search again
" again after this column
" echom 'CTIRP - same line match, ignoring'
continue
@@ -136,23 +142,23 @@ function! s:CheckToIgnoreRightParan( prev_lnum, num_levels )
" echom 'CTIRP - match: ' . line(".") . ' ' . getline(".")
- if getline(matching_paran) =~? '\(if\|while\)\>'
+ if getline(matching_paren) =~? '\(if\|while\)\>'
" echom 'CTIRP - if/while ignored: ' . line(".") . ' ' . getline(".")
- let ignore_paran = ignore_paran + 1
+ let ignore_paren = ignore_paren + 1
endif
" One match found, decrease and check for further matches
- let num_right_paran = num_right_paran - 1
+ let num_right_paren = num_right_paren - 1
endwhile
" Fallback - just move back one
" return a:prev_indent - shiftwidth()
- return ignore_paran
+ return ignore_paren
endfunction
" Based on the keyword provided, loop through previous non empty
-" non comment lines to find the statement that initated the keyword.
+" non comment lines to find the statement that initiated the keyword.
" Return its indent level
" CASE ..
" WHEN ...
@@ -295,26 +301,26 @@ function! GetSQLIndent()
" echom 'prevl - SQLBlockStart - indent ' . ind . ' line: ' . prevline
elseif prevline =~ '[()]'
if prevline =~ '('
- let num_unmatched_left = s:CountUnbalancedParan( prevline, '(' )
+ let num_unmatched_left = s:CountUnbalancedParen( prevline, '(' )
else
let num_unmatched_left = 0
endif
if prevline =~ ')'
- let num_unmatched_right = s:CountUnbalancedParan( prevline, ')' )
+ let num_unmatched_right = s:CountUnbalancedParen( prevline, ')' )
else
let num_unmatched_right = 0
- " let num_unmatched_right = s:CountUnbalancedParan( prevline, ')' )
+ " let num_unmatched_right = s:CountUnbalancedParen( prevline, ')' )
endif
if num_unmatched_left > 0
- " There is a open left paranethesis
+ " There is a open left parenthesis
" increase indent
let ind = ind + ( shiftwidth() * num_unmatched_left )
elseif num_unmatched_right > 0
- " if it is an unbalanced paranethesis only unindent if
+ " if it is an unbalanced parenthesis only unindent if
" it was part of a command (ie create table(..) )
" instead of part of an if (ie if (....) then) which should
" maintain the indent level
- let ignore = s:CheckToIgnoreRightParan( prevlnum, num_unmatched_right )
+ let ignore = s:CheckToIgnoreRightParen( prevlnum, num_unmatched_right )
" echom 'prevl - ) unbalanced - CTIRP - ignore: ' . ignore
if prevline =~ '^\s*)'
@@ -357,8 +363,8 @@ function! GetSQLIndent()
" elseif line =~ '^\s*)\s*;\?\s*$'
" elseif line =~ '^\s*)'
elseif line =~ '^\s*)'
- let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
- let ignore = s:CheckToIgnoreRightParan( v:lnum, num_unmatched_right )
+ let num_unmatched_right = s:CountUnbalancedParen( line, ')' )
+ let ignore = s:CheckToIgnoreRightParen( v:lnum, num_unmatched_right )
" If the line ends in a ), then reduce the indent
" This catches items like:
" CREATE TABLE T1(
@@ -368,7 +374,7 @@ function! GetSQLIndent()
" But we do not want to unindent a line like:
" IF ( c1 = 1
" AND c2 = 3 ) THEN
- " let num_unmatched_right = s:CountUnbalancedParan( line, ')' )
+ " let num_unmatched_right = s:CountUnbalancedParen( line, ')' )
" if num_unmatched_right > 0
" elseif strpart( line, strlen(line)-1, 1 ) =~ ')'
" let ind = ind - shiftwidth()
diff --git a/runtime/indent/testdir/yaml.in b/runtime/indent/testdir/yaml.in
index e3d77e2543..8515e1752c 100644
--- a/runtime/indent/testdir/yaml.in
+++ b/runtime/indent/testdir/yaml.in
@@ -12,3 +12,8 @@ map2:
map: &anchor
map: val
# END_INDENT
+
+# START_INDENT
+map: multiline
+value
+# END_INDENT
diff --git a/runtime/indent/testdir/yaml.ok b/runtime/indent/testdir/yaml.ok
index b97b2e5896..5ca2871fc9 100644
--- a/runtime/indent/testdir/yaml.ok
+++ b/runtime/indent/testdir/yaml.ok
@@ -12,3 +12,8 @@ map2:
map: &anchor
map: val
# END_INDENT
+
+# START_INDENT
+map: multiline
+ value
+# END_INDENT
diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim
index 9621b2b6ed..26e14effb2 100644
--- a/runtime/indent/yaml.vim
+++ b/runtime/indent/yaml.vim
@@ -1,7 +1,8 @@
" Vim indent file
-" Language: YAML
-" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
-" Last Change: 2019 Sep 28
+" Language: YAML
+" Maintainer: Nikolai Pavlov <zyx.vim@gmail.com>
+" Last Update: Lukas Reineke
+" Last Change: 2020 Jun 07
" Only load this indent file when no other was loaded.
if exists('b:did_indent')
@@ -53,7 +54,7 @@ let s:c_ns_anchor_name = s:c_ns_anchor_char.'+'
let s:c_ns_anchor_property = '\v\&'.s:c_ns_anchor_name
let s:ns_word_char = '\v[[:alnum:]_\-]'
-let s:ns_tag_char = '\v%(%\x\x|'.s:ns_word_char.'|[#/;?:@&=+$.~*''()])'
+let s:ns_tag_char = '\v%('.s:ns_word_char.'|[#/;?:@&=+$.~*''()])'
let s:c_named_tag_handle = '\v\!'.s:ns_word_char.'+\!'
let s:c_secondary_tag_handle = '\v\!\!'
let s:c_primary_tag_handle = '\v\!'
@@ -62,7 +63,7 @@ let s:c_tag_handle = '\v%('.s:c_named_tag_handle.
\ '|'.s:c_primary_tag_handle.')'
let s:c_ns_shorthand_tag = '\v'.s:c_tag_handle . s:ns_tag_char.'+'
let s:c_non_specific_tag = '\v\!'
-let s:ns_uri_char = '\v%(%\x\x|'.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])'
+let s:ns_uri_char = '\v%('.s:ns_word_char.'\v|[#/;?:@&=+$,.!~*''()[\]])'
let s:c_verbatim_tag = '\v\!\<'.s:ns_uri_char.'+\>'
let s:c_ns_tag_property = '\v'.s:c_verbatim_tag.
\ '\v|'.s:c_ns_shorthand_tag.