From 823d9e0af1c5bf1b971d0e54e0454db833b4f230 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Fri, 24 Jun 2022 14:45:07 +0200 Subject: vim-patch:a57b553b4328 (#19076) Update runtime files https://github.com/vim/vim/commit/a57b553b432855667c9f26edfad95ccfdd24a6b7 --- runtime/indent/testdir/vim.in | 6 ++++++ runtime/indent/testdir/vim.ok | 6 ++++++ runtime/indent/vim.vim | 13 ++++++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'runtime') 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 -" 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 -- cgit