diff options
author | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-04 18:55:51 +0200 |
---|---|---|
committer | Adam Stankiewicz <sheerun@sher.pl> | 2020-09-04 18:55:51 +0200 |
commit | 556ba05ceeb3e1053c2a99a303a13b2b8e82f0f9 (patch) | |
tree | dd62fc10b34bd6a09581c6d759b6aff3aee60f9d | |
parent | 262960fa223139eb5e02647e77af6bac13a17066 (diff) | |
download | vim-polyglot-556ba05ceeb3e1053c2a99a303a13b2b8e82f0f9.tar.gz vim-polyglot-556ba05ceeb3e1053c2a99a303a13b2b8e82f0f9.zip |
Ignore heredoc when detecting indentv4.9.1
-rw-r--r-- | plugin/polyglot.vim | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/plugin/polyglot.vim b/plugin/polyglot.vim index ccdef112..bcf255f0 100644 --- a/plugin/polyglot.vim +++ b/plugin/polyglot.vim @@ -31,6 +31,7 @@ function! s:guess(lines) abort let triplequote = 0 let backtick = 0 let xmlcomment = 0 + let heredoc = '' let minindent = 10 let spaces_minus_tabs = 0 @@ -87,6 +88,18 @@ function! s:guess(lines) abort continue endif + " This is correct order because both "<<EOF" and "EOF" matches end + if heredoc != '' + if line =~# heredoc + let heredoc = '' + endif + continue + endif + let herematch = matchlist(line, '\C<<\W*\([A-Z]\+\)\s*$') + if len(herematch) > 0 + let heredoc = herematch[1] . '$' + endif + let spaces_minus_tabs += line[0] == "\t" ? 1 : -1 if line[0] == "\t" |