mirror of
https://github.com/sheerun/vim-polyglot.git
synced 2025-11-08 11:33:52 -05:00
Ignore heredoc when detecting indent
This commit is contained in:
@@ -31,6 +31,7 @@ function! s:guess(lines) abort
|
|||||||
let triplequote = 0
|
let triplequote = 0
|
||||||
let backtick = 0
|
let backtick = 0
|
||||||
let xmlcomment = 0
|
let xmlcomment = 0
|
||||||
|
let heredoc = ''
|
||||||
let minindent = 10
|
let minindent = 10
|
||||||
let spaces_minus_tabs = 0
|
let spaces_minus_tabs = 0
|
||||||
|
|
||||||
@@ -87,6 +88,18 @@ function! s:guess(lines) abort
|
|||||||
continue
|
continue
|
||||||
endif
|
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
|
let spaces_minus_tabs += line[0] == "\t" ? 1 : -1
|
||||||
|
|
||||||
if line[0] == "\t"
|
if line[0] == "\t"
|
||||||
|
|||||||
Reference in New Issue
Block a user