summaryrefslogtreecommitdiffstats
path: root/indent/puppet.vim
diff options
context:
space:
mode:
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