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

Re: Inconsistent jump after undo of multi-line change

Expand Messages
  • Jürgen Krämer
    Hi, ... don t use bars after :keepjumps. :keepjumps takes a command as argument. Putting the bars there told Vim to execute :keepjumps without arguments (which
    Message 1 of 5 , Sep 4, 2011
    • 0 Attachment
      Hi,

      bootleq wrote:
      >
      > 2011/9/5 James Vega <jamessan@... <mailto:jamessan@...>>
      >>
      >> On Sun, Sep 04, 2011 at 10:47:53AM +0800, bootleq wrote:
      >> > About the automatically added jump:
      >> > It' reasonable when undoing a single change.
      >> > But if we do many changes at one function, one undo block,
      >> > we might want to keep the cursor unchanged after undo.
      >>
      >> You can use the :keepjumps command to perform an action without altering
      >> the jump list.
      >>
      >> --
      >> James
      >> GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@... <mailto:jamessan@...>>
      >
      > Yes, thanks, but in this case, with
      > 1) :keepjumps | call setline(1, 'bar')
      > 2) :keepjumps | undo
      > it still jump to line 1.

      don't use bars after :keepjumps. :keepjumps takes a command as argument.
      Putting the bars there told Vim to execute :keepjumps without arguments
      (which is a no-op), and than to execute :call and :undo, 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_dev" 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
    • bootleq
      Thank you, I can keep jumplist unchanged now. But back to my first message, the cursor still silently move to first changed line. 2011/9/5 Jürgen Krämer
      Message 2 of 5 , Sep 5, 2011
      • 0 Attachment
        Thank you, I can keep jumplist unchanged now.

        But back to my first message, the cursor still silently move to first changed line.

        2011/9/5 Jürgen Krämer <jottkaerr@...>

        Hi,

        bootleq wrote:
        >
        > 2011/9/5 James Vega <jamessan@... <mailto:jamessan@...>>
        >>
        >>     On Sun, Sep 04, 2011 at 10:47:53AM +0800, bootleq wrote:
        >>     > About the automatically added jump:
        >>     > It' reasonable when undoing a single change.
        >>     > But if we do many changes at one function,  one undo block,
        >>     > we might want to keep the cursor unchanged after undo.
        >>
        >>     You can use the :keepjumps command to perform an action without altering
        >>     the jump list.
        >>
        >>     --
        >>     James
        >>     GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan@... <mailto:jamessan@...>>
        >
        > Yes, thanks, but in this case, with
        > 1) :keepjumps | call setline(1, 'bar')
        > 2) :keepjumps | undo
        > it still jump to line 1.

        don't use bars after :keepjumps. :keepjumps takes a command as argument.
        Putting the bars there told Vim to execute :keepjumps without arguments
        (which is a no-op), and than to execute :call and :undo, 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_dev" 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

        --
        You received this message from the "vim_dev" 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.