aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2022-06-24 14:45:07 +0200
committerGitHub <noreply@github.com>2022-06-24 14:45:07 +0200
commit823d9e0af1c5bf1b971d0e54e0454db833b4f230 (patch)
treea57c1ef373f5f1caba1f53136872e8c3ee881f8b
parent3a4fa22badc5595afc0a994ead965ff32ccf6c76 (diff)
downloadrneovim-823d9e0af1c5bf1b971d0e54e0454db833b4f230.tar.gz
rneovim-823d9e0af1c5bf1b971d0e54e0454db833b4f230.tar.bz2
rneovim-823d9e0af1c5bf1b971d0e54e0454db833b4f230.zip
vim-patch:a57b553b4328 (#19076)
Update runtime files https://github.com/vim/vim/commit/a57b553b432855667c9f26edfad95ccfdd24a6b7
-rw-r--r--runtime/indent/testdir/vim.in6
-rw-r--r--runtime/indent/testdir/vim.ok6
-rw-r--r--runtime/indent/vim.vim13
3 files changed, 22 insertions, 3 deletions
diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in
index 699e4c243d..873045bc2c 100644
--- a/runtime/indent/testdir/vim.in
+++ b/runtime/indent/testdir/vim.in
@@ -30,6 +30,12 @@ for x in [
eval 0
endfor
+let t = [
+\ {
+\ 'k': 'val',
+\ },
+\ ]
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok
index f597d97e80..8e70abe619 100644
--- a/runtime/indent/testdir/vim.ok
+++ b/runtime/indent/testdir/vim.ok
@@ -30,6 +30,12 @@ for x in [
eval 0
endfor
+let t = [
+ \ {
+ \ 'k': 'val',
+ \ },
+ \ ]
+
" END_INDENT
" START_INDENT
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim
index cd2d4982d8..8076b2df07 100644
--- a/runtime/indent/vim.vim
+++ b/runtime/indent/vim.vim
@@ -1,7 +1,7 @@
" Vim indent file
" Language: Vim script
" Maintainer: Bram Moolenaar <Bram@vim.org>
-" Last Change: 2022 Mar 01
+" Last Change: 2022 Jun 24
" Only load this indent file when no other was loaded.
if exists("b:did_indent")
@@ -36,6 +36,14 @@ endfunc
let s:lineContPat = '^\s*\(\\\|"\\ \)'
function GetVimIndentIntern()
+ " If the current line has line continuation and the previous one too, use
+ " the same indent. This does not skip empty lines.
+ let cur_text = getline(v:lnum)
+ let cur_has_linecont = cur_text =~ s:lineContPat
+ if cur_has_linecont && v:lnum > 1 && getline(v:lnum - 1) =~ s:lineContPat
+ return indent(v:lnum - 1)
+ endif
+
" Find a non-blank line above the current line.
let lnum = prevnonblank(v:lnum - 1)
@@ -44,8 +52,7 @@ function GetVimIndentIntern()
" If the current line doesn't start with '\' or '"\ ' and below a line that
" starts with '\' or '"\ ', use the indent of the line above it.
- let cur_text = getline(v:lnum)
- if cur_text !~ s:lineContPat
+ if !cur_has_linecont
while lnum > 0 && getline(lnum) =~ s:lineContPat
let lnum = lnum - 1
endwhile