Loading ...
Sorry, an error occurred while loading the content.

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

Expand Messages
  • Sergey Vakulenko
    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
    Message 1 of 3 , May 2, 2011
    • 0 Attachment
      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.

      --
      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
    • ZyX
      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
      Message 2 of 3 , May 2, 2011
      • 0 Attachment
        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.
      • Sergey Vakulenko
        On not exist buffers BufHidden() also return true. But, with buflisted() it s works great! thanks a lot ... -- You received this message from the vim_use
        Message 3 of 3 , May 2, 2011
        • 0 Attachment
          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....@...> 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
        Your message has been successfully submitted and would be delivered to recipients shortly.