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

Re: Edit same in two windows same Vim session

Expand Messages
  • Benjamin R. Haskell
    ... If you really just want two windows (with no other windows), it s ... | ( ) separates two commands ... scb is short for scrollbind crb is short
    Message 1 of 5 , Mar 1, 2011
    • 0 Attachment
      On Tue, 1 Mar 2011, Colin Beighley wrote:

      > Hello,
      >
      > I'm wondering if anyone knows of a way to edit the same file in two
      > windows in the same Vim session, where the file within the two windows
      > stays in sync with eachother.

      If you really just want two windows (with no other windows), it's
      particularly easy:

      :sp | windo se scb crb

      :sp[lit] splits the current buffer
      '|' (<bar>) separates two commands
      :windo does something over every window
      :se[t] sets a variable in each of those windows
      'scb' is short for 'scrollbind'
      'crb' is short for 'cursorbind'

      More info on each at:

      :help :split
      :help :bar
      :help :windo
      :help :set
      :help 'scrollbind'
      :help 'cursorbind'


      For two arbitrary windows, with possibly many other windows open, it's
      only slightly more complex, possibly with a better way to do it.

      :se scb crb | sp | se crb

      The second :se[t] command is necessary because the 'cursorbind' setting
      isn't copied through the :sp[lit].

      If you want vertical rather than horizontal splits, change the :sp[lit]
      commands to :vs[plit]'s:

      e.g.
      :se scb crb | vs | se crb

      :help :vsplit

      --
      Best,
      Ben

      --
      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
    • Colin Beighley
      Actually I didn t test this before I sent the message (sorry) and it appears that Vim automatically does this when you edit the same file in two windows in the
      Message 2 of 5 , Mar 2, 2011
      • 0 Attachment
        Actually I didn't test this before I sent the message (sorry) and it
        appears that Vim automatically does this when you edit the same file
        in two windows in the same session.

        On Mar 1, 8:48 pm, "Benjamin R. Haskell" <v...@...> wrote:
        > On Tue, 1 Mar 2011, Colin Beighley wrote:
        > > Hello,
        >
        > > I'm wondering if anyone knows of a way to edit the same file in two
        > > windows in the same Vim session, where the file within the two windows
        > > stays in sync with eachother.
        >
        > If you really just want two windows (with no other windows), it's
        > particularly easy:
        >
        > :sp | windo se scb crb
        >
        > :sp[lit] splits the current buffer
        > '|' (<bar>) separates two commands
        > :windo does something over every window
        > :se[t] sets a variable in each of those windows
        > 'scb' is short for 'scrollbind'
        > 'crb' is short for 'cursorbind'
        >
        > More info on each at:
        >
        > :help :split
        > :help :bar
        > :help :windo
        > :help :set
        > :help 'scrollbind'
        > :help 'cursorbind'
        >
        > For two arbitrary windows, with possibly many other windows open, it's
        > only slightly more complex, possibly with a better way to do it.
        >
        > :se scb crb | sp | se crb
        >
        > The second :se[t] command is necessary because the 'cursorbind' setting
        > isn't copied through the :sp[lit].
        >
        > If you want vertical rather than horizontal splits, change the :sp[lit]
        > commands to :vs[plit]'s:
        >
        > e.g.
        > :se scb crb | vs | se crb
        >
        > :help :vsplit
        >
        > --
        > Best,
        > Ben

        --
        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
      • Charles E Campbell Jr
        ... FYI: The MPage plugin (see http://mysite.verizon.net/astronaut/vim/index.html#MPAGE) allows one to have multiple windows open on the same file with
        Message 3 of 5 , Mar 22, 2011
        • 0 Attachment
          Colin Beighley wrote:
          > Actually I didn't test this before I sent the message (sorry) and it
          > appears that Vim automatically does this when you edit the same file
          > in two windows in the same session.
          >
          > On Mar 1, 8:48 pm, "Benjamin R. Haskell"<v...@...> wrote:
          >
          >> On Tue, 1 Mar 2011, Colin Beighley wrote:
          >>
          >>> Hello,
          >>>
          >>
          >>> I'm wondering if anyone knows of a way to edit the same file in two
          >>> windows in the same Vim session, where the file within the two windows
          >>> stays in sync with eachother.
          >>>
          FYI: The MPage plugin (see
          http://mysite.verizon.net/astronaut/vim/index.html#MPAGE) allows one to
          have multiple windows open on the same file with sequential windows
          showing sequential lines of text.

          Regards,
          Chip Campbell

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