[Novalug] VI - rieties (was Re: vi question)

Jon LaBadie novalugml at jgcomp.com
Sun Apr 12 19:59:04 EDT 2009


On Sun, Apr 12, 2009 at 07:45:00PM -0400, Mackenzie Morgan wrote:
> On Sunday 12 April 2009 6:15:54 pm Sean McGowan wrote:
> > On Sun, 2009-04-12 at 14:43 -0400, Mackenzie Morgan wrote:
> > > Ugh, yeah old Solaris boxen are why I learned the :e scp:// trick.  Real 
> vi 
> > > doesn't have backspace-beyond-insertion-point.  I really like being able 
> to 
> > > use backspace though.  ci{ is a nice addition in vim, but not having it 
> isn't 
> > > nearly as annoying as the backspace thing.
> > 
> > You should never have to backspace beyond your insertion point if you
> > are using vi properly.  If you are, then you are not taking advantage of
> > the variety of commands and movements.  Backspace is only for typos
> > while you are in insert mode.
> 
> What if I am typing along, go into command mode to go do something elsewhere, 
> go back to where I was, insert, type the rest of a sentence, decide 
> "nevermind, I don't like that phrasing" and want to backspace to the 3rd word 
> from the start of the sentence?  I'd have to sit there, take my hands off the 
> keyboard, point at the screen and count "1, 2, 3, 4, .....ok, 15 words back" 
> then type d15b.  Or I could hold down backspace.

Don't count, approximate, then go in small steps.  d9b then dbdbdbdbdb (you
counted wrong, it was 14 :)

If you just want to delete characters, use x (or in your example, X).
As was said, backspace is for typo correction in insert mode.
It just happens to also act like a cursor arrow in cmd mode.

> 
> I know how to delete to the end of a sentence ("df.")

No, that delete upto, and including a period.  d) (right paren) deletes to
the beginning of the next sentence.

> but what about 
> backwards to a certain character to delete to the start of the sentence?  I 

For many commands in vi there are lower and upper case forms that differ in
the direction the act.  In your case f and F.  When they exist, the lower
case form acts toward the end of the buffer and the upper case acts toward
the beginning of the buffer.  Examples are F/f, T/t, N/n (slight fudge), X,x.

> don't know anything that's the opposite of "f" and even if I did...if I wanted 
> the 3rd-word-in-sentence as above, unless I could say (supposing the opposite 
> of f was t) dt.-3w ...I have no idea how to do that.

btw t is almost like f, except f includes the target, t doesn't.  So t, moves to
the character in front of the next comma, f, moves onto the next comma.

-- 
Jon H. LaBadie                  jon at jgcomp.com
 JG Computing
 12027 Creekbend Drive		(703) 787-0884
 Reston, VA  20194		(703) 787-0922 (fax)



More information about the Novalug mailing list