summaryrefslogtreecommitdiffstats
path: root/indent/puppet.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2021-03-01 13:44:50 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2021-03-01 13:44:50 +0100
commitcc63193ce82c1e7b9ee2ad7d0ddd14e8394211ef (patch)
tree260360b1a32ca19635f8c8884b81fcec9ed51168 /indent/puppet.vim
parent4c10562d2cc9b084518284c49a158558da5180a7 (diff)
downloadvim-polyglot-cc63193ce82c1e7b9ee2ad7d0ddd14e8394211ef.tar.gz
vim-polyglot-cc63193ce82c1e7b9ee2ad7d0ddd14e8394211ef.zip
Update
Diffstat (limited to 'indent/puppet.vim')
-rw-r--r--indent/puppet.vim9
1 files changed, 7 insertions, 2 deletions
diff --git a/indent/puppet.vim b/indent/puppet.vim
index cabde843..1067e9e0 100644
--- a/indent/puppet.vim
+++ b/indent/puppet.vim
@@ -105,11 +105,16 @@ function! GetPuppetIndent(...)
let ind = indent(s:PrevNonMultilineString(pnum - 1))
endif
- if pline =~ '\({\|\[\|(\|:\)\s*\(#.*\)\?$'
+ let l:bracketAtEndOfLinePattern = '\({\|\[\|(\|:\)\s*\(#.*\)\?$'
+ if pline =~ l:bracketAtEndOfLinePattern
+ let l:i = match(pline, l:bracketAtEndOfLinePattern)
+ let l:syntaxType = synIDattr(synID(pnum, l:i + 1, 0), 'name')
+ if l:syntaxType !~# '\(Comment\|String\)$'
let ind += &sw
+ endif
elseif pline =~ ';$' && pline !~ '[^:]\+:.*[=+]>.*'
let ind -= &sw
- elseif pline =~ '^\s*include\s\+.*,$' && pline !~ '[=+]>'
+ elseif pline =~# '^\s*include\s\+.*,$' && pline !~ '[=+]>'
let ind += &sw
endif