diff options
author | Christian Clason <christian.clason@uni-due.de> | 2021-09-11 16:47:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-11 16:47:45 +0200 |
commit | e31652879e4ecfc63b450626209d09df79336de0 (patch) | |
tree | 14ed290a0ea6c12efa6c1ea56475b1ecf9f92b6c /runtime/indent | |
parent | e7d2102c917b22435939543d752ff81de3a75d25 (diff) | |
download | rneovim-e31652879e4ecfc63b450626209d09df79336de0.tar.gz rneovim-e31652879e4ecfc63b450626209d09df79336de0.tar.bz2 rneovim-e31652879e4ecfc63b450626209d09df79336de0.zip |
vim-patch:partial 53f7fccc9413 (#15631)
* vim-patch:partial 53f7fccc9413
Update runtime files
https://github.com/vim/vim/commit/53f7fccc9413c9f770694b56f40f242d383b2d5f
omit macros/hanoi/hanoi.vim
omit spell/tet/main.aap
omit tools/shtags.1
omit tools/xcmdsrv_client.c
skip doc/pattern.txt (requires 8.2.3110; 8.2.{1665,1872})
skip doc/map.txt (requires 8.2.3228)
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/bzl.vim | 41 | ||||
-rw-r--r-- | runtime/indent/testdir/xml.in | 2 | ||||
-rw-r--r-- | runtime/indent/testdir/xml.ok | 2 |
3 files changed, 28 insertions, 17 deletions
diff --git a/runtime/indent/bzl.vim b/runtime/indent/bzl.vim index 6904bfdedb..cf4cfb5fad 100644 --- a/runtime/indent/bzl.vim +++ b/runtime/indent/bzl.vim @@ -1,7 +1,7 @@ " Vim indent file " Language: Bazel (http://bazel.io) " Maintainer: David Barnett (https://github.com/google/vim-ft-bzl) -" Last Change: 2017 Jun 13 +" Last Change: 2021 Jul 08 if exists('b:did_indent') finish @@ -41,30 +41,41 @@ function GetBzlIndent(lnum) abort if exists('g:pyindent_open_paren') let l:pyindent_open_paren = g:pyindent_open_paren endif - let g:pyindent_nested_paren = 'shiftwidth() * 2' - let g:pyindent_open_paren = 'shiftwidth() * 2' + let g:pyindent_nested_paren = 'shiftwidth()' + let g:pyindent_open_paren = 'shiftwidth()' endif let l:indent = -1 - " Indent inside parens. - " Align with the open paren unless it is at the end of the line. - " E.g. - " open_paren_not_at_EOL(100, - " (200, - " 300), - " 400) - " open_paren_at_EOL( - " 100, 200, 300, 400) call cursor(a:lnum, 1) let [l:par_line, l:par_col] = searchpairpos('(\|{\|\[', '', ')\|}\|\]', 'bW', \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" . \ " synIDattr(synID(line('.'), col('.'), 1), 'name')" . \ " =~ '\\(Comment\\|String\\)$'") if l:par_line > 0 - call cursor(l:par_line, 1) - if l:par_col != col('$') - 1 - let l:indent = l:par_col + " Indent inside parens. + if searchpair('(\|{\|\[', '', ')\|}\|\]', 'W', + \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :" . + \ " synIDattr(synID(line('.'), col('.'), 1), 'name')" . + \ " =~ '\\(Comment\\|String\\)$'") && line('.') == a:lnum + " If cursor is at close parens, match indent with open parens. + " E.g. + " foo( + " ) + let l:indent = indent(l:par_line) + else + " Align with the open paren unless it is at the end of the line. + " E.g. + " open_paren_not_at_EOL(100, + " (200, + " 300), + " 400) + " open_paren_at_EOL( + " 100, 200, 300, 400) + call cursor(l:par_line, 1) + if l:par_col != col('$') - 1 + let l:indent = l:par_col + endif endif endif diff --git a/runtime/indent/testdir/xml.in b/runtime/indent/testdir/xml.in index b6333340e2..88ad51e484 100644 --- a/runtime/indent/testdir/xml.in +++ b/runtime/indent/testdir/xml.in @@ -15,7 +15,7 @@ text comment </tag1> <!-- text comment -end coment --> +end comment --> </tag0> <!-- END_INDENT --> diff --git a/runtime/indent/testdir/xml.ok b/runtime/indent/testdir/xml.ok index cfdf701c11..d5e2289cb3 100644 --- a/runtime/indent/testdir/xml.ok +++ b/runtime/indent/testdir/xml.ok @@ -15,7 +15,7 @@ </tag1> <!-- text comment - end coment --> + end comment --> </tag0> <!-- END_INDENT --> |