summaryrefslogtreecommitdiffstats
path: root/ftplugin/terraform.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2021-07-08 11:54:15 +0200
committerAdam Stankiewicz <sheerun@sher.pl>2021-07-08 11:54:15 +0200
commitc794f186c0a618d2d4cdd5445d9ff20e6f640762 (patch)
tree11e6b01bac01b0ec694c8fa5c574870f5e268182 /ftplugin/terraform.vim
parent4f5388350be1052f610b830c8fce8fbc17370ec6 (diff)
downloadvim-polyglot-c794f186c0a618d2d4cdd5445d9ff20e6f640762.tar.gz
vim-polyglot-c794f186c0a618d2d4cdd5445d9ff20e6f640762.zip
Update
Diffstat (limited to 'ftplugin/terraform.vim')
-rw-r--r--ftplugin/terraform.vim47
1 files changed, 19 insertions, 28 deletions
diff --git a/ftplugin/terraform.vim b/ftplugin/terraform.vim
index 36b42dbc..1f4ef2cc 100644
--- a/ftplugin/terraform.vim
+++ b/ftplugin/terraform.vim
@@ -8,39 +8,30 @@ endif
if exists('b:did_ftplugin') || v:version < 700 || &compatible
finish
endif
-let b:did_ftplugin = 1
-
-let s:cpo_save = &cpoptions
-set cpoptions&vim
-
-" j is a relatively recent addition; silence warnings when setting it.
-setlocal formatoptions-=t formatoptions+=croql
-silent! setlocal formatoptions+=j
-let b:undo_ftplugin = 'setlocal formatoptions<'
-
-if !has('patch-7.4.1142')
- " Include hyphens as keyword characters so that a keyword appearing as
- " part of a longer name doesn't get partially highlighted.
- setlocal iskeyword+=-
- let b:undo_ftplugin .= ' iskeyword<'
-endif
+" Have only kept the terraform versions of these options for backwards
+" compatibility.
if get(g:, 'terraform_fold_sections', 0)
- setlocal foldmethod=syntax
- let b:undo_ftplugin .= ' foldmethod<'
-endif
+ let s:hcl_fold_sections_save = get(g:, 'hcl_fold_sections', 0)
+ let g:hcl_fold_sections=1
+end
-" Set the commentstring
-setlocal commentstring=#%s
-let b:undo_ftplugin .= ' commentstring<'
+if get(g:, 'terraform_align', 0)
+ let s:hcl_align_save = get(g:, 'hcl_align', 0)
+ let g:hcl_align=1
+end
-if get(g:, 'terraform_align', 0) && exists(':Tabularize')
- inoremap <buffer> <silent> = =<Esc>:call terraform#align()<CR>a
- let b:undo_ftplugin .= '|iunmap <buffer> ='
-endif
+runtime! ftplugin/hcl.vim
-let &cpoptions = s:cpo_save
-unlet s:cpo_save
+if exists('s:hcl_align_save')
+ let g:hcl_align = s:hcl_align_save
+end
+if exists('s:hcl_fold_sections_save')
+ let g:hcl_fold_sections = s:hcl_fold_sections_save
+end
+
+let s:cpo_save = &cpoptions
+set cpoptions&vim
if !exists('g:terraform_binary_path')
let g:terraform_binary_path='terraform'