hashivim / vim-terraform

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

Folding Not Working #171

Closed mthbrown closed 3 years ago

mthbrown commented 3 years ago

Hi,

For some reason, I'm not able to get folding to work. My config looks like this:

let g:terraform_align=1
let g:terraform_fmt_on_save=1
let g:terraform_fold_sections=1
Plug hashivim/vim-terraform

but I don't get any folding and whenever I try to run any fold command, I get the error:

E490: No fold found

When I check on foldmethod, I find that it is set to syntax. Any ideas? Thanks.

dimbleby commented 3 years ago

Perhaps you are using nvim-treesitter, which provides highlighting through a completely different mechanism than the syntax?

If so you probably want something like

set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
mthbrown commented 3 years ago

Hi @dimbleby. Thank you for the suggestion but I'm using normal Vim, not Neovim. So I'm not using nvim-treesitter

dimbleby commented 3 years ago

Then, with apologies, I got nothing.

My usual approach in such cases is to:

which is all very well, but not solving your problem.

Will leave this open for a few days because that's only polite: but as things stand I'm afraid I don't expect to do anything with this and will close it out after a respectable time has passed.

mthbrown commented 3 years ago

No worries. I tried it with a minimal ~/.vimrc:

set nocompatible              " be iMproved, required

" === PLUGINS ===

call plug#begin('~/.vim/plugged')

" Terraform + HCL
let g:terraform_align=1
let g:terraform_fmt_on_save=1
let g:terraform_fold_sections=1
Plug 'hashivim/vim-terraform'

" Initialize plugin system
call plug#end()

but it still didn't work. I'll to figure it out. Thanks.

mthbrown commented 3 years ago

It seems to work correctly on my other machines. I'll try to determine what the issue with this specific one is and report back

mthbrown commented 3 years ago

I ended up just wiping out my entire Vim config + plugins and then rebuilding it from scratch from my dotfiles and now it works. Thanks