Saturday, March 6, 2010

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

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

No comments: