You are not logged in.

#1 2012-06-13 17:39:55

zenten
Member
Registered: 2012-03-27
Posts: 25

[Solved] How do I delete from cursor to beginning of line in Vi?

I'm wondering if there's a way to delete from the the cursor to the beginning of the current line in Vi, basically doing D backwards.  I would find this very useful, as manually doing this is getting annoying.

Edit: Of course after days of searching I figure it out right after asking.  It's d0 that I need to type in.

Last edited by zenten (2012-06-13 17:42:45)

Offline

#2 2012-06-13 18:20:59

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: [Solved] How do I delete from cursor to beginning of line in Vi?

I saw your thread title and that it was already solved, so I gave myself a little quiz to see if I knew the answer before reading what you wrote.

Since I use 'd$' to delete to the end of the line, I guessed that it was 'd0' to delete to the beginning of the line. Looks like I was right! Who says Vim isn't intutitive?

I didn't even know about the 'D' command... tongue

Offline

#3 2012-06-13 18:25:50

litemotiv
Forum Fellow
Registered: 2008-08-01
Posts: 5,026

Re: [Solved] How do I delete from cursor to beginning of line in Vi?

drcouzelis wrote:

I didn't even know about the 'D' command... tongue

Oh wow, neither did i!


ᶘ ᵒᴥᵒᶅ

Offline

#4 2012-06-13 18:32:13

bohoomil
Banned
Registered: 2010-09-04
Posts: 2,377
Website

Re: [Solved] How do I delete from cursor to beginning of line in Vi?

If

d$

then

d^

;p


:: Registered Linux User No. 223384

:: github
:: infinality-bundle+fonts: good looking fonts made easy

Offline

#5 2012-06-13 22:43:29

Odaer
Member
Registered: 2010-08-14
Posts: 87

Re: [Solved] How do I delete from cursor to beginning of line in Vi?

As this is in the vimtutor It's probably a idea to do it in vi instead, it give a easy introduction to vim and vims movements. Most of it is relevant for vi I think.

Last edited by Odaer (2012-06-13 22:49:11)

Offline

Board footer

Powered by FluxBB