On Sun, Feb 21, 2016 at 03:15:17PM +0100, Bram Moolenaar wrote:
>
> Anton Lindqvist wrote:
>
> > Hi,
> > This patch adds an optional second argument to the bufwinnr function
> > which if present returns all windows associated with the given buffer
> > across all tabs. This is useful in order to determine if a buffer is
> > present in several windows. I'm currently using this patch in order to
> > get backspace to behave accordingly: if the current buffer is present in
> > other windows than the current one, close the window, otherwise wipe the
> > current buffer.
> >
> > nnoremap <BS> :call BufferClose()<CR>
> > func BufferClose()
> > if len(bufwinnr('%', 1)) > 1
> > wincmd c
> > else
> > bwipe
> > endif
> > endfunc
> >
> > I didn't end up using the FOR_ALL_TAB_WINDOWS macro since I needed to
> > reset winnr and increment tabnr in the outer loop.
>
> Thanks. Seems useful.
>
> I have been thinking of adding a unique window number. Some plugins
> have problems finding the right window after splitting and closing
> windows. The current window number changes then, thus it requires
> looping over windows to find the right window. Netrw had a bug related
> to this.
>
> getwinid() ID of current winow
> getwinnr({id}) window nr of {id} or -1 if not open
> gettabnr({id}) tab page nr of {id} or -1 if not open
> gotowin({id})
>
> I wonder how this bufwinnr() change fits in.
Unique window numbers sounds like a great addition. The bufwinnr()
function could then return a list unique window numbers instead of a
list of dictionaries. If the window number is unique it should be all
the data needed in order to interact/manipulate the window using the
functions mentioned.
--
:wq
--
--
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.