I am looking for a functionality in vimdiff where on opening the diff, it could use the info. from cscope etc. such that the lines changed if are in within a function, that function will be unfolded and rest of the unchanged code should remain folded. Using context value in diffopt, we can specify the no. of neighboring lines which stays unfolded.
Asked
Active
Viewed 430 times
2
-
By default creating a diff view sets the fold expression to "diff", but in theory you might be able to change this. How would Vim know which function to unfold? – Ben Feb 04 '14 at 12:53
-
Oh, and any answer would probably require a LOT of scripting. There is no built-in way. – Ben Feb 04 '14 at 12:53
-
Ben, vim can know in similar way it jumps to start or end of the function by pressing [[ or ]] – Kapil Jain Feb 23 '14 at 07:27
-
So, you want to unfold EVERY function with changed code? And always the entire function, instead of using a set number of lines? By the way, ]] and [[ don't use cscope or anything, they're just "dumb" text searches. – Ben Feb 24 '14 at 15:25
-
yes, I want to unfold every function with changed code instead of fixed no. of lines. – Kapil Jain Feb 25 '14 at 16:59