hashivim/vim-terraform

filetype not getting evaluated

Closed this issue · 1 comments

I use vundle. The plugin was not working and it turned out the reason was my filetype was set to tf.

Adding this to my ~/.vimrc fixed the issue for me:

augroup terraform_filetype
    au!
    autocmd BufNewFile,BufRead *tf   set filetype=terraform
augroup END

I'm surprised I needed this though. I looked at vim-terraform/ftplugin/terraform.vim and it contains this:

" By default, Vim associates .tf files with TinyFugue - tell it not to.
autocmd! filetypedetect BufRead,BufNewFile *.tf
autocmd BufRead,BufNewFile *.tf set filetype=terraform
autocmd BufRead,BufNewFile *.tfvars set filetype=terraform
autocmd BufRead,BufNewFile *.tfstate set filetype=json
autocmd BufRead,BufNewFile *.tfstate.backup set filetype=json

If I add echo "Did we get here?" to vim-terraform/ftplugin/terraform.vim to confirm if that code ran or not, I do not see the echo that would confirm the file is getting evaluated.

Any idea why vim-terraform/ftplugin/terraform.vim is not getting evaluated?

:help :filetype, perhaps?

Doesn't seem likely to be an issue in this plugin, anyway.