I'd like vimdiff to start with all the folded sections opened.

So far I have tried the following:

vimdiff -c "set nofoldenable" -R <(tree -d directory1) <(tree -d directory2)

with the -c "set nofoldenable" being the attempt to achieve what I want. However, that doesn't work, because it only affects the left window, not the right one.

I want to put this into a shell function for convenience, so the length of the actual invocation doesn't matter to me.

I have also tried -c "bufdo set nofoldenable" which has the desired effect w.r.t. the folded sections, but leads vimdiff to scroll out of sync and no longer highlights the differences either. So doing this kills all the utility vimdiff offers.

Currently I start vimdiff and then use the zR command to open all folded sections.

2 Answers 2


zR sets foldlevel to a high value, so try that:

vimdiff -c "set foldlevel=9999" -R <(tree -d directory1) <(tree -d directory2)

Try using windo instead of bufdo:

vimdiff -c "windo set nofoldenable" -R <(tree -d directory1) <(tree -d directory2)
  • I usually have vimdiff -c 'windo set syntax=off' to remove syntax highlighting in my bash alias, too.
    – Rolf
    Mar 1, 2017 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.