Monday, March 28, 2011

Re: Way to clear line without removing the line?

On Mon, 28 Mar 2011, David Kahn wrote:

> I am guessing this should be a real simple question but cant find an
> answer readily:
>
> If I want to remove all contents of a line, I press 'd' twice. But in
> most cases I want the line to still be there (meaning the space, so
> after deleting I would have a blank line), so I tend to find myself
> when deleting afterward replacing the line (like shift + O).
>
> So if I am making any sense, is there a way to remove all contents of
> a line without removing the line itself (I guess similarly to using x
> to delete a character but for a whole line)?

As with many Vim actions, there's more than one way to do it.

My method is to do:
0D

0 goes to the beginning of the line.
D deletes the rest of the line (rest = all, since at the beginning).

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

No comments: