vim2hs icon indicating copy to clipboard operation
vim2hs copied to clipboard

Add an option for turning off folding

Open Cypher1 opened this issue 8 years ago • 6 comments

Currently its not obvious that there is an option for turning off the folding that vim2hs uses, this means that users have to unfold things themselves even in small files.

If there was a way to turn this on and off then we can write vimscripts that control when we want folds or just turn it off by default. Ta

Cypher1 avatar Dec 08 '16 05:12 Cypher1

Bump! If anybody knows how to turn it off I would be grateful!

jbddc avatar Dec 11 '16 15:12 jbddc

second bump, would like to be able to disable code folding by default

kgwinnup avatar Jan 18 '17 21:01 kgwinnup

To disable this, go to the ~/.vim/plugged/vim2hs/syntax/haskell.vim and comment out the call vim2hs#haskell#syntax#folds().

Another workaround I guess it to fork the repo, get rid of the folds function and use the forked version yourself.

shuwens avatar Jul 15 '17 21:07 shuwens

Well there are plenty of ways you can disable it without touching vim2hs or adding options to it:

" Use folds but keep them open by default
setglobal foldlevelstart=99

" Disable folding all-together
setglobal nofoldenable

" Disable folding for Haskell
autocmd FileType haskell setlocal nofoldenable

" Or just don't use the vim2hs folding
autocmd FileType haskell setlocal foldmethod& foldtext&

You can also quickly open all folds in a window with zR if you still want to have folds by default.

dag avatar Nov 22 '17 15:11 dag

Admittedly that last line might get overridden by vim2hs unless you move it from the autocmd to an after directory (:help after-directory) which might be an argument for adding an option, but foldenable isn't touched by vim2hs so the previous line should work just as fine, and then you can quickly turn folding back on if you want. Can't do that with a custom vim2hs option.

dag avatar Nov 22 '17 15:11 dag

@dag if you're still interested in fixing this. The problem isn't that vim2hs supports folding. It's that the feature is too opinionated. Many of us don't want folding to always be on & automatic, hence an option in the plugin that is doing the automatic folding is the right way to configure it.

Turning folding off globally is heavy handed and not a good solution. Please accept the relevant PR

Cypher1 avatar Jan 24 '22 21:01 Cypher1