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

Richard Rognlie rrognlie@gamerz.net
Mon Apr 13 09:05:02 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.
> 
> I know how to delete to the end of a sentence ("df.")  but what about 
> backwards to a certain character to delete to the start of the sentence?  I 
> 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.

you know about marks, right?   if you're on a character/line, hit mx.

m = sets a mark
x == any single character... that becomes the mark's name.

now at any time, I have move to the mark.   regardless of where I am;

'x  takes me to the line where I set the mark 'x'

`x takes you to the actual character where you set the mark 'x'

how hold on tight... here's the fun bit...

you can use those marks for delete and change

d'x   delete the line you are on, forward or backward to the line where you set
        the mark
d`x  deletes from the character where you are to the character where you 
        set the mark

similarly... c'x and c`x

so you never need to count.   just set a mark at one end... move to the other
end... and do whatever you need to do.


> _______________________________________________
> Novalug mailing list
> Novalug@calypso.tux.org
> http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug


-- 
 /  \__  | Richard Rognlie / Sendmail Ninja / Gamerz.NET Lackey
 \__/  \ | http://www.gamerz.net/~rrognlie    <rrognlie at gamerz.net>
 /  \__/ | Creator of pbmserv@gamerz.net
 \__/    |                Helping reduce world productivity since 1994



More information about the Novalug mailing list