This commit is contained in:
Adam Stankiewicz
2021-07-08 11:54:15 +02:00
parent 4f5388350b
commit c794f186c0
25 changed files with 341 additions and 327 deletions

View File

@@ -8,40 +8,31 @@ endif
if exists('b:did_ftplugin') || v:version < 700 || &compatible
finish
endif
let b:did_ftplugin = 1
" Have only kept the terraform versions of these options for backwards
" compatibility.
if get(g:, 'terraform_fold_sections', 0)
let s:hcl_fold_sections_save = get(g:, 'hcl_fold_sections', 0)
let g:hcl_fold_sections=1
end
if get(g:, 'terraform_align', 0)
let s:hcl_align_save = get(g:, 'hcl_align', 0)
let g:hcl_align=1
end
runtime! ftplugin/hcl.vim
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
" 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
if get(g:, 'terraform_fold_sections', 0)
setlocal foldmethod=syntax
let b:undo_ftplugin .= ' foldmethod<'
endif
" Set the commentstring
setlocal commentstring=#%s
let b:undo_ftplugin .= ' commentstring<'
if get(g:, 'terraform_align', 0) && exists(':Tabularize')
inoremap <buffer> <silent> = =<Esc>:call terraform#align()<CR>a
let b:undo_ftplugin .= '|iunmap <buffer> ='
endif
let &cpoptions = s:cpo_save
unlet s:cpo_save
if !exists('g:terraform_binary_path')
let g:terraform_binary_path='terraform'
endif