diff options
author | Bram Moolenaar <Bram@vim.org> | 2021-01-25 21:14:57 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2021-01-25 21:14:57 +0100 |
commit | e0e3917554327f2524066f89fbbef9c83c1535da (patch) | |
tree | 8cea7343dbb8e20c6bc3248152ddb94fad59eac0 /runtime/indent | |
parent | e5ea346a07a7750c02a89996b67716b43c767d06 (diff) |
Update runtime files.
Diffstat (limited to 'runtime/indent')
-rw-r--r-- | runtime/indent/fortran.vim | 6 | ||||
-rw-r--r-- | runtime/indent/testdir/vim.in | 5 | ||||
-rw-r--r-- | runtime/indent/testdir/vim.ok | 5 | ||||
-rw-r--r-- | runtime/indent/vim.vim | 11 | ||||
-rw-r--r-- | runtime/indent/yaml.vim | 8 |
5 files changed, 27 insertions, 8 deletions
diff --git a/runtime/indent/fortran.vim b/runtime/indent/fortran.vim index 696320288d..26ed33a54d 100644 --- a/runtime/indent/fortran.vim +++ b/runtime/indent/fortran.vim @@ -74,11 +74,15 @@ endif if (b:fortran_fixed_source == 1) setlocal indentexpr=FortranGetFixedIndent() if exists("*FortranGetFixedIndent") + let &cpoptions = s:cposet + unlet s:cposet finish endif else setlocal indentexpr=FortranGetFreeIndent() if exists("*FortranGetFreeIndent") + let &cpoptions = s:cposet + unlet s:cposet finish endif endif @@ -213,7 +217,7 @@ function FortranGetFixedIndent() return ind endfunction -let &cpoptions=s:cposet +let &cpoptions = s:cposet unlet s:cposet " vim:sw=2 tw=130 diff --git a/runtime/indent/testdir/vim.in b/runtime/indent/testdir/vim.in index 47e692975f..f652dbda79 100644 --- a/runtime/indent/testdir/vim.in +++ b/runtime/indent/testdir/vim.in @@ -10,6 +10,11 @@ let cmd = \ 'some ' \ 'string' +if 1 +let x = [ +\ ] +endif + " END_INDENT " START_INDENT diff --git a/runtime/indent/testdir/vim.ok b/runtime/indent/testdir/vim.ok index 3f53c5286c..b8592c18eb 100644 --- a/runtime/indent/testdir/vim.ok +++ b/runtime/indent/testdir/vim.ok @@ -10,6 +10,11 @@ let cmd = \ 'some ' \ 'string' +if 1 + let x = [ + \ ] +endif + " END_INDENT " START_INDENT diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 3e502c9adb..b031d1f2ed 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: 2021 Jan 06 +" Last Change: 2021 Jan 21 " Only load this indent file when no other was loaded. if exists("b:did_indent") @@ -38,6 +38,9 @@ function GetVimIndentIntern() " Find a non-blank line above the current line. let lnum = prevnonblank(v:lnum - 1) + " The previous line, ignoring line continuation + let prev_text_end = lnum > 0 ? getline(lnum) : '' + " 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) @@ -51,6 +54,8 @@ function GetVimIndentIntern() if lnum == 0 return 0 endif + + " the start of the previous line, skipping over line continuation let prev_text = getline(lnum) let found_cont = 0 @@ -147,13 +152,13 @@ function GetVimIndentIntern() endif " Below a line starting with "]" we must be below the end of a list. - if prev_text =~ '^\s*]' + if prev_text_end =~ '^\s*]' let ind = ind - shiftwidth() endif " A line ending in "{"/"[} is most likely the start of a dict/list literal, " indent the next line more. Not for a continuation line. - if prev_text =~ '[{[]\s*$' && !found_cont + if prev_text_end =~ '[{[]\s*$' && !found_cont let ind = ind + shiftwidth() endif diff --git a/runtime/indent/yaml.vim b/runtime/indent/yaml.vim index 26e14effb2..8dca5cd763 100644 --- a/runtime/indent/yaml.vim +++ b/runtime/indent/yaml.vim @@ -2,16 +2,13 @@ " Language: YAML " Maintainer: Nikolai Pavlov <zyx.vim@gmail.com> " Last Update: Lukas Reineke -" Last Change: 2020 Jun 07 +" Last Change: 2021 Jan 19 " Only load this indent file when no other was loaded. if exists('b:did_indent') finish endif -let s:save_cpo = &cpo -set cpo&vim - let b:did_indent = 1 setlocal indentexpr=GetYAMLIndent(v:lnum) @@ -25,6 +22,9 @@ if exists('*GetYAMLIndent') finish endif +let s:save_cpo = &cpo +set cpo&vim + function s:FindPrevLessIndentedLine(lnum, ...) let prevlnum = prevnonblank(a:lnum-1) let curindent = a:0 ? a:1 : indent(a:lnum) |