summaryrefslogtreecommitdiffstats
path: root/indent/terraform.vim
diff options
context:
space:
mode:
Diffstat (limited to 'indent/terraform.vim')
-rw-r--r--indent/terraform.vim61
1 files changed, 1 insertions, 60 deletions
diff --git a/indent/terraform.vim b/indent/terraform.vim
index 32c194ef..3f7690f8 100644
--- a/indent/terraform.vim
+++ b/indent/terraform.vim
@@ -6,63 +6,4 @@ endif
if exists('b:did_indent')
finish
endif
-let b:did_indent = 1
-
-let s:cpo_save = &cpoptions
-set cpoptions&vim
-
-setlocal nolisp
-setlocal autoindent shiftwidth=2 tabstop=2 softtabstop=2 expandtab
-setlocal indentexpr=TerraformIndent(v:lnum)
-setlocal indentkeys+=<:>,0=},0=)
-let b:undo_indent = 'setlocal lisp< autoindent< shiftwidth< tabstop< softtabstop<'
- \ . ' expandtab< indentexpr< indentkeys<'
-
-let &cpoptions = s:cpo_save
-unlet s:cpo_save
-
-if exists('*TerraformIndent')
- finish
-endif
-
-let s:cpo_save = &cpoptions
-set cpoptions&vim
-
-function! TerraformIndent(lnum)
- " Beginning of the file should have no indent
- if a:lnum == 0
- return 0
- endif
-
- " Usual case is to continue at the same indent as the previous non-blank line.
- let prevlnum = prevnonblank(a:lnum-1)
- let thisindent = indent(prevlnum)
-
- " If that previous line is a non-comment ending in [ { (, increase the
- " indent level.
- let prevline = getline(prevlnum)
- if prevline !~# '^\s*\(#\|//\)' && prevline =~# '[\[{\(]\s*$'
- let thisindent += &shiftwidth
- endif
-
- " If the current line ends a block, decrease the indent level.
- let thisline = getline(a:lnum)
- if thisline =~# '^\s*[\)}\]]'
- let thisindent -= &shiftwidth
- endif
-
- " If the previous line starts a block comment /*, increase by one
- if prevline =~# '/\*'
- let thisindent += 1
- endif
-
- " If the previous line ends a block comment */, decrease by one
- if prevline =~# '\*/'
- let thisindent -= 1
- endif
-
- return thisindent
-endfunction
-
-let &cpoptions = s:cpo_save
-unlet s:cpo_save
+runtime! indent/hcl.vim