diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-01 23:05:15 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-05-01 23:19:58 -0400 |
commit | ac83c6eba65e92d434f3245f518f869c94751e6b (patch) | |
tree | 7c5625df2e83bde29193d2ff414813aa26f7d832 /runtime/indent/vim.vim | |
parent | 8f8602d2dfc87257c1d72492aa1d285f335bb942 (diff) | |
download | rneovim-ac83c6eba65e92d434f3245f518f869c94751e6b.tar.gz rneovim-ac83c6eba65e92d434f3245f518f869c94751e6b.tar.bz2 rneovim-ac83c6eba65e92d434f3245f518f869c94751e6b.zip |
vim-patch:e0e391755432
Update runtime files.
https://github.com/vim/vim/commit/e0e3917554327f2524066f89fbbef9c83c1535da
Diffstat (limited to 'runtime/indent/vim.vim')
-rw-r--r-- | runtime/indent/vim.vim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/runtime/indent/vim.vim b/runtime/indent/vim.vim index 21e496802c..a10ee54ee3 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 |