Open
Labels
Description
When I enable folds with foldmethod=syntax, all the methods are being fold strictly over the method:
def foo
puts "foo"
end
def bar
puts "bar"
end
def foobar
puts "foobar"
end
becomes:
+--- 3 lines: def foo····································
+--- 3 lines: def bar····································
+--- 3 lines: def foobar·································
what would be nice would it to have the folds eagerly include the extra space after the fold, so that we could have instead:
+--- 3 lines: def foo····································
+--- 3 lines: def bar····································
+--- 3 lines: def foobar·································
which can be obtained by removing empty lines between method, but that's bad practice, and as I navigate within vim with {/} a lot, I got to keep it :)
Maybe this could be configured as a preference?
Thank you for the good work ♥
Activity
dkearns commentedon Apr 4, 2019
This seems like something that would be better done at a more general level with a plugin that removes whitespace between fold regions.
It also has unacceptable ramifications for any other code expecting end to end at the end of end and for color schemes that highlight the background specifically for that syntax group.
To deal with your specific issue, however, you can add something like the following to your ~/.vim/after/syntax/ruby.vim
syn region rubyMethodBlockFold start="\<def\>" end="\<end\_s*\n" contains=rubyMethodBlock keepend transparent foldguyzmo commentedon Apr 6, 2019
thank you for the tip, maybe could such a line be enabled within ruby.vim with a config option, to fit all situations?