6

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

4

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

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

Try using windo instead of bufdo:

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.