hashivim / vim-terraform

basic vim/terraform integration
http://hashivim.github.io/vim-terraform
ISC License
1.07k stars 110 forks source link

filetype not getting evaluated #108

Closed scallister closed 5 years ago

scallister commented 5 years ago

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?

dimbleby commented 5 years ago

:help :filetype, perhaps?

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