[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bi

> I'm going to finally ask this question.
> What is it that is so special about vi?  Does it decompile programs or write
> them all by itself or leap tall buildings with a single bound?

It works from any keyboard, you don't need arrows, f-keys or other
unlikely stuff.  You keep your hands on the keyboard all the time
even when doing search commands, etc. With only a couple of exceptions
everything takes exactly the same syntax [count] [range] command [escape]
so you always type what you mean.  For example a typical sequence is
/old text<enter>                 (find old text)
2cwreplacement words<escape>     (change 2 words)
n                                (find next occurance)
.                                (repeat change)

Is anything really easier or less keyboard-intensive than that?

> Really.  I've been on unix boxes for about 7 years and only used vi when I
> had no other choice.  Is there some hidden, undocumented functionallity to it?

It's all documented somewhere.  Insert a row of '= ' with 35i =<esc>.
 = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
convert columns of 'Last, First' to 'First Last' with 
:%s/^\(.*\), \(.*\)/\2 \1/
(and if it doesn't work right the first time, just 'u'ndo).

Build complicated ex mode commands in the edit buffer itself or read in
some you've done before, delete to a register, execute the register
and if it doesn't quite work you can undo, yank back the text of the
command and fix it.  With other editors if your complicated transformations
don't work you usually get to make the same typing mistake all over again
because they think commands are somehow magically different from the
text. Also ex mode is good for scripting things that don't work in
sed (like ':$-10d' to delete the 10'th line from the end).

Les Mikesell

Reply to: