I am writing a vim plugin in which I need to identify all those files that are currently different. These are the ones for which it is installed diff. I went through the manual, but could not find much.
Is it possible to do this.
This question is really related to the question how-to-detect-the-position-of-window-in-vim . In this question, I tried to get the position of the window to determine which of the differences is correct and which remains one. The solution I got was to use winnr ()
This solution can only work if there are only 2 windows (which are different). I want to make it general, so even if several windows are open in vim, I can determine which one is on the left and which one is correct. This is what I was thinking about to solve the problem.
- Get a list of all listed buffers
- For each of these buffers, determine whether there is
diff 1for this - If
diff- 1, use bufwinnr()to get the window number. - From the windows, determine which one is left and which one is correct. one will have a lower window number on the left
- And then determine if the current buffer (in which
alt-left`alt-right`) is on the left or right, using winnr of the current buffer.
, , 1 2. 1 ls , . . , diff 1 .
.