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

Commnad over a window

Expand Messages
  • JuanPablo
    hi, if I have multiple windows. How can I apply a command on a specified window without having to move to this? example: g/text/d only in the first window the
    Message 1 of 4 , Jan 31, 2010
    • 0 Attachment
      hi,
      if I have multiple windows. How can I apply a command on a specified
      window without having to move to this?
      example: g/text/d only in the first window

      the same question in buffers case.

      Many thanks.
      --
      JuanPablo

      --
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Ben Fritz
      ... In general, you can t. What are you trying to accomplish? There are many window switching commands that make it easy to go to a window and jump right back
      Message 2 of 4 , Feb 1, 2010
      • 0 Attachment
        On Jan 31, 8:38 pm, JuanPablo <jabar...@...> wrote:
        > hi,
        > if I have multiple windows. How can I apply a command on a specified
        > window without having to move to this?
        > example: g/text/d only in the first window
        >
        > the same question in buffers case.
        >

        In general, you can't.

        What are you trying to accomplish? There are many window switching
        commands that make it easy to go to a window and jump right back in a
        script for example.

        --
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
      • JuanPablo
        and there is some way of listing the windows? similar to buffers ? ... -- JuanPablo -- You received this message from the vim_use maillist. For more
        Message 3 of 4 , Feb 2, 2010
        • 0 Attachment
          and there is some way of listing the windows?
          similar to buffers
          ?

          On Mon, Feb 1, 2010 at 11:43 AM, Ben Fritz <fritzophrenic@...> wrote:
          >
          >
          > On Jan 31, 8:38 pm, JuanPablo <jabar...@...> wrote:
          >> hi,
          >> if I have multiple windows. How can I apply a command on a specified
          >> window without having to move to this?
          >> example: g/text/d only in the first window
          >>
          >> the same question in buffers case.
          >>
          >
          > In general, you can't.
          >
          > What are you trying to accomplish? There are many window switching
          > commands that make it easy to go to a window and jump right back in a
          > script for example.
          >
          > --
          > You received this message from the "vim_use" maillist.
          > For more information, visit http://www.vim.org/maillist.php



          --
          JuanPablo

          --
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
        • Tony Mechelynck
          ... For buffers, it s easy: see :help :ls; but for use in a script see the help links near the bottom of this message. For windows, it s more involved: windows
          Message 4 of 4 , Mar 30 5:25 PM
          • 0 Attachment
            On 03/02/10 01:27, JuanPablo wrote:
            > and there is some way of listing the windows?
            > similar to buffers
            > ?

            For buffers, it's easy: see :help :ls; but for use in a script see the
            help links near the bottom of this message.

            For windows, it's more involved: windows are defined by their number
            (starting at 1 at top-left and with the highest number at bottom-right)
            within their tabpages (which are also numbered starting at 1). Unlike
            buffers, there is no "window identifier" which remains unchanged when
            you move windows and tabpages around, or open and close them.

            Now here we go:

            tabpagenr()
            the number of the current tab page
            tabpagenr('$')
            the total number of tab pages

            winnr()
            the number of the current window within the current tab page
            winnr('$')
            the number of windows within the current tab page
            winnr('#')
            the number of the latest window accessed in this tab
            before the current one; or 0 if there was no previous window
            or if it was in a different tabpage

            tabpagewinnr(t)
            the number of the current window in the t-th tab
            tabpagewinnr(t,'$')
            the total number of windows in the t-th tab
            tabpagwinnr(t,'#')
            the previous window for the t-th tab

            tabpagebuflist()
            a List whose items are the buffer numbers for the current tab
            This is zero-based!
            tabpagebuflist()[0] is the number of the buffer in window 1
            tabpagebuflist(t)
            the same for the t-th tab
            Notes:
            - In case of error (t < 1 || t > tabpagenr('$'),
            the number 0 is returned.
            - A buffer can be displayed in more than one window.

            winbufnr(0)
            the number of the buffer in the current window
            (of the current tab)
            winbufnr(w)
            the number of the buffer in the w-th window
            (of the current tab)
            == tabpagebuflist()[w - 1]
            Returns -1 if there is no w-th window

            See also:
            :help tabp*(<Ctrl-D>
            :help win*(<Ctrl-D>
            :help buf*(<Ctrl-D>

            where <Ctrl-D> means: hit Ctrl-D (i.e. hit d while holding Ctrl).

            And see ":help setting-tabline" for a couple of user-defined functions
            which use these builtin functions in order to display the text-mode tab
            line (showing the current buffer in each tab). See also the example
            under tabpagebuflist() to get a List of all buffers in all tabs (some of
            them may appear more than once, and hidden buffers, which are loaded but
            not displayed, won't appear at all in that List). Either of these
            examples can be expanded to get a two-level list of all buffers listed
            per tab.



            Best regards,
            Tony.
            --
            Adore, v.:
            To venerate expectantly.
            -- Ambrose Bierce, "The Devil's Dictionary"

            --
            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

            To unsubscribe, reply using "remove me" as the subject.
          Your message has been successfully submitted and would be delivered to recipients shortly.