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

vimdiff optimisation

Expand Messages
  • Richard Hartmann
    Hi all, I have two issues which I need help with: 1) Is there any way to do to cursor position what scrollbind does to scroll position? I want to jump to the
    Message 1 of 4 , Oct 1, 2007
    • 0 Attachment
      Hi all,


      I have two issues which I need help with:

      1) Is there any way to do to cursor position what scrollbind does to
      scroll position? I want to jump to the 'same' line every time I switch
      focus.

      2) Is there any way to tell vim 'take this line[s] and overwrite the
      according line[s] in the other buffer' other than yy^w<scroll>Pdd? I
      would be happy to script this if I had a reliable way to go to the line
      on the same heigth in the other buffer, so this is highly related to 1)


      Thanks,
      Richard

      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Jürgen Krämer
      Hi, ... I don t know a solution for this, ... ... but you can use do and dp to copy the differences from and to the other buffer, respectively. Regards,
      Message 2 of 4 , Oct 1, 2007
      • 0 Attachment
        Hi,

        Richard Hartmann wrote:
        >
        >
        > I have two issues which I need help with:
        >
        > 1) Is there any way to do to cursor position what scrollbind does to
        > scroll position? I want to jump to the 'same' line every time I switch
        > focus.

        I don't know a solution for this, ...

        > 2) Is there any way to tell vim 'take this line[s] and overwrite the
        > according line[s] in the other buffer' other than yy^w<scroll>Pdd? I
        > would be happy to script this if I had a reliable way to go to the line
        > on the same heigth in the other buffer, so this is highly related to 1)

        but you can use

        do

        and

        dp

        to copy the differences from and to the other buffer, respectively.

        Regards,
        Jürgen

        --
        Sometimes I think the surest sign that intelligent life exists elsewhere
        in the universe is that none of it has tried to contact us. (Calvin)

        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Tim Chase
        ... While I don t have an answer for this, as sometimes vim seems to track cursor location, and sometimes it doesn t. But yes, this would be useful to know
        Message 3 of 4 , Oct 1, 2007
        • 0 Attachment
          > 1) Is there any way to do to cursor position what scrollbind
          > does to scroll position? I want to jump to the 'same' line
          > every time I switch focus.

          While I don't have an answer for this, as sometimes vim seems to
          track cursor location, and sometimes it doesn't. But yes, this
          would be useful to know how to do.

          > 2) Is there any way to tell vim 'take this line[s] and
          > overwrite the according line[s] in the other buffer' other
          > than yy^w<scroll>Pdd? I would be happy to script this if I had
          > a reliable way to go to the line on the same heigth in the
          > other buffer, so this is highly related to 1)


          You might be interested in the

          :diffput
          :diffget

          pair of commands. I find diffput more useful because if the line
          is missing in the file, you can't move the cursor there to do a
          diffget, so you have to move to the cursor to the other file and
          do a diffput instead. There are also "do" and "dp" commands in
          normal mode to do this. It does push around the entire
          change-block that you're in, rather than just the current line,
          but I've found that usually I want the whole block of changes,
          rather than doing it line by line.

          You can read about it at

          :help copy-diffs

          and following where you can read about the above four commands as
          well as some tips on using them.

          Hope this helps,

          -tim




          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • Richard Hartmann
          Thanks to the both of you :) --~--~---------~--~----~------------~-------~--~----~ You received this message from the vim_use maillist. For more information,
          Message 4 of 4 , Oct 1, 2007
          • 0 Attachment
            Thanks to the both of you :)

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