diff options
Diffstat (limited to 'ftplugin/terraform.vim')
-rw-r--r-- | ftplugin/terraform.vim | 47 |
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' |