comparison runtime/indent/vim.vim @ 18489:1cd44535be32

Update runtime files. Commit: https://github.com/vim/vim/commit/1ff14ba24c4d85c008d7abe5e140dbb497ffea8d Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 2 14:09:23 2019 +0100 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Sat, 02 Nov 2019 14:15:04 +0100
parents bdbb049c2aa8
children 94eda51ba9ba
comparison
equal deleted inserted replaced
18488:1d7e6b677119 18489:1cd44535be32
1 " Vim indent file 1 " Vim indent file
2 " Language: Vim script 2 " Language: Vim script
3 " Maintainer: Bram Moolenaar <Bram@vim.org> 3 " Maintainer: Bram Moolenaar <Bram@vim.org>
4 " Last Change: 2016 Jun 27 4 " Last Change: 2019 Oct 31
5 5
6 " Only load this indent file when no other was loaded. 6 " Only load this indent file when no other was loaded.
7 if exists("b:did_indent") 7 if exists("b:did_indent")
8 finish 8 finish
9 endif 9 endif
54 54
55 " Add a 'shiftwidth' after :if, :while, :try, :catch, :finally, :function 55 " Add a 'shiftwidth' after :if, :while, :try, :catch, :finally, :function
56 " and :else. Add it three times for a line that starts with '\' or '"\ ' 56 " and :else. Add it three times for a line that starts with '\' or '"\ '
57 " after a line that doesn't (or g:vim_indent_cont if it exists). 57 " after a line that doesn't (or g:vim_indent_cont if it exists).
58 let ind = indent(lnum) 58 let ind = indent(lnum)
59
60 " In heredoc indenting works completely differently.
61 if has('syntax_items')
62 let syn_here = synIDattr(synID(v:lnum, 1, 1), "name")
63 if syn_here =~ 'vimLetHereDocStop'
64 " End of heredoc: use indent of matching start line
65 let lnum = v:lnum - 1
66 while lnum > 0
67 if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
68 return indent(lnum)
69 endif
70 let lnum -= 1
71 endwhile
72 return 0
73 endif
74 if syn_here =~ 'vimLetHereDoc'
75 if synIDattr(synID(lnum, 1, 1), "name") !~ 'vimLetHereDoc'
76 " First line in heredoc: increase indent
77 return ind + shiftwidth()
78 endif
79 " Heredoc continues: no change in indent
80 return ind
81 endif
82 endif
83
59 if cur_text =~ s:lineContPat && v:lnum > 1 && prev_text !~ s:lineContPat 84 if cur_text =~ s:lineContPat && v:lnum > 1 && prev_text !~ s:lineContPat
60 if exists("g:vim_indent_cont") 85 if exists("g:vim_indent_cont")
61 let ind = ind + g:vim_indent_cont 86 let ind = ind + g:vim_indent_cont
62 else 87 else
63 let ind = ind + shiftwidth() * 3 88 let ind = ind + shiftwidth() * 3