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

Re: how to get list of open windows

Expand Messages
  • Tony Mechelynck
    ... help winnr() also mentions that winnr( $ ) is both the number of the last window and the window count . IOW, no holes. The fact that the windows are
    Message 1 of 8 , Sep 1, 2007
      Tim Chase wrote:
      >> Actually, the windows are identified by sequential numbers from 1 to
      >> winnr('$') and they don't have any fixed ids so they are reliable only
      >> when the window layout has not changed.
      > Ah...something I must have missed somewhere. Other than "Try it
      > and see that it happens to be the case", is there some place to
      > learn this in the docs? The best I could find was
      > "windows are numbered from top-left to bottom-right"
      > in ":help windows.txt". However, this doesn't make it obvious
      > that they're time-sensitive (if I changed my window layout, the
      > buffer<->window mapping changes), and that holes never appear in
      > the count if windows are closed.
      > With that foreknowledge that they're monotonically increasing
      > from 1..winnr('$'), the results are, as Hari and others noted,
      > considerably easier to produce :)
      > -tim

      help winnr() also mentions that winnr('$') is both "the number of the last
      window" and "the window count". IOW, no holes.

      The fact that the windows are numbered top-to-bottom implies (the way I read
      it) that when you rearrange your window layout, the window-number-to-buffer
      mapping changes. Unlike buffer numbers (which are attributed once and for all,
      and never change even if a lower-numbered buffer is ":bwipeout"ed), a window's
      number changes whenever a lower-numbered window is opened or closed. (Window
      number 1 is always at top left and window number winnr('$') is always at
      bottom right.)

      Best regards,
      "The whole world is about three drinks behind."
      -- Humphrey Bogart

      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    Your message has been successfully submitted and would be delivered to recipients shortly.