2016-04-07 3:24 GMT+03:00 Daniel Hahler <[email protected]>:
> I am seeing the following error from time to time, although only two diff
> windows are visible:
>
> E101: More than two buffers in diff mode, don't know which one to use
>
> This might happen when closing a window which had diff mode enabled, and
> there
> appears no way to reset it easily?!
>
> I've seen usage of getbufvar in that context, but the following returns
> all buffers when in a window with diff set, and is empty otherwise
> (although another window is in diff mode):
>
> :echo filter(range(1, bufnr('$')), "getbufvar(v:val, '&diff')")
>
> Is there a way to see for which buffers diff is set?
>
&diff is window-local option. Your question has no sense, it may not be
set for any buffer. You may get a list of windows in which this option is
set and transform this into a list of buffers displayed in those windows.
`getbufvar()` is evaluated in the current window context, with different
buffer context. So, of course, your code does not work; but VimL is rather
permissive so it does not work, but as well does not throw any errors. If
you wrote
:python for buf in vim.buffers: print(buf.number, buf.options['diff'])
you would get KeyError because my python bindings are not that permissive:
you cannot use `options` attribute of `vim.Buffer` instance to get option
that is not buffer-local or buffer-local/global.
> It could certainly be displayed with the E101 error (since it can only be
> 4 (E96)).
>
> It seems like diffoff! could provide a way to turn it off, but that
> appears
> to handle windows (and their buffers) only:
>
> :diffo[ff]! Switch off diff mode for the current window and in all windows
> in the current tab page where 'diff' is set. Resetting
> related options only happens in a window that has 'diff' set,
> if the current window does not have 'diff' set then no options
> in it are changed.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly or view it on GitHub
> <https://github.com/vim/vim/issues/736>
>
> --
> --
> You received this message from the "vim_dev" maillist.
> Do not top-post! Type your reply below the text you are replying to.
> For more information, visit http://www.vim.org/maillist.php
>
> ---
> You received this message because you are subscribed to the Google Groups
> "vim_dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.