Monday, May 2, 2011

Re: how to get list of not displayed (hidden or unloaded) buffers

On not exist buffers BufHidden() also return true.
But, with buflisted() it's works great!


thanks a lot


On May 2, 10:44 pm, ZyX <zyx....@gmail.com> wrote:
> Reply to message «how to get list of not displayed (hidden or unloaded)
> buffers»,
> sent 22:50:57 02 May 2011, Monday
> by Sergey Vakulenko:
>
> Try the following code:
>     function s:BufHidden(bufnr)
>         return empty(filter(map(range(1, tabpagenr('$')),
>                                \'tabpagebuflist(v:val)'),
>                             \'index(v:val, a:bufnr)!=-1'))
>     endfunction
>
> Original message:
>
> > Hello
> > I want to know, how i can identify buffer, if it's displayed on screen
> > or not.
>
> > For example i open buffer 'option.c', then open buffer 'file2.txt' in
> > same window/tab.
> > 'option.c' became hidden:
>
> > ----
>
> > :buffers
>
> >  25 #h   "d:\workspace\sources\gvim_73\vim-7.3\vim73\src\option.c"
> > line 1
> >  26 %a   "file2.txt"                    line 1
> > Press ENTER or type command to continue
> > ----
>
> > i need something like this:
>
> >     for buffer_ in bufnr('$'))
> >         if buffer_ == "not displayed"
> >                   do .....
> >          endif
> >     endfor
>
> > thanks in advance
> > Sergey V.
>
>
>
>  signature.asc
> < 1KViewDownload

--
You received this message from the "vim_use" 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

No comments: