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

Re: How to delete everything before the cursor until the beginning of the line?

Expand Messages
  • Chris Jones
    ... dw, d$, dG, d{, dgg, etc. IOW, d +cursor movement.. what was I thinking. CJ -- You received this message from the vim_use maillist. For more
    Message 1 of 7 , Jan 1, 2010
    • 0 Attachment
      On Fri, Jan 01, 2010 at 06:40:24PM EST, Tim Chase wrote:
      > Chris Jones wrote:
      > > On Fri, Jan 01, 2010 at 06:04:46PM EST, Peng Yu wrote:

      > >> 'D' deletes everything after the cursor until the end of the line. Is
      > >> there a command that delete everything before the cursor until the
      > >> beginning of the line?
      > >
      > > v0d is what I do.. three key presses. Surely there's a better way?
      >
      >
      > d0
      >
      > should do the trick. No need to go visual.

      :-)

      dw, d$, dG, d{, dgg, etc. IOW, 'd'+cursor movement.. what was I
      thinking.

      CJ

      --
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Tony Mechelynck
      ... There is a difference though: v0d deletes everything from the start of the line to the cursor location _included_ (v highlights the cursor character, then
      Message 2 of 7 , Mar 6, 2010
      • 0 Attachment
        On 02/01/10 02:07, Chris Jones wrote:
        > On Fri, Jan 01, 2010 at 06:40:24PM EST, Tim Chase wrote:
        >> Chris Jones wrote:
        >>> On Fri, Jan 01, 2010 at 06:04:46PM EST, Peng Yu wrote:
        >
        >>>> 'D' deletes everything after the cursor until the end of the line. Is
        >>>> there a command that delete everything before the cursor until the
        >>>> beginning of the line?
        >>>
        >>> v0d is what I do.. three key presses. Surely there's a better way?
        >>
        >>
        >> d0
        >>
        >> should do the trick. No need to go visual.
        >
        > :-)
        >
        > dw, d$, dG, d{, dgg, etc. IOW, 'd'+cursor movement.. what was I
        > thinking.
        >
        > CJ
        >

        There is a difference though: v0d deletes everything from the start of
        the line to the cursor location _included_ (v highlights the cursor
        character, then 0 extends the visual selection to the start of the line,
        keeping the former cursor location highlighted, and finally d deletes
        the selection). With d0, the character under the cursor is not deleted,
        because 0 is an "exclusive" motion.

        Best regards,
        Tony.
        --
        "There are two ways of disliking poetry; one way is to dislike it, the
        other is to read Pope."
        -- Oscar Wilde

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