Thanks
Keith
If you just want to print them out, you can use:
:g/.\{81,\}/p
Unfortunately, the \{n,m\} construction doesn't work in search mode.
BTW, is there a way to easily re-execute the last ex command in vi?
--
Trip Martin
ni...@acm.rpi.edu
--
Trip Martin
ni...@acm.rpi.edu
Try this.. Open up a new line (o) and enter the following keystroke sequence -
/<Esc>81a.<Esc>"ddd@d
This will generate the following on the new line -
/.................................................................................
delete the line to buffer d, and execute it to find the next 81-character
sequence. You can then use n/N to keep searching for other lines. You'd have
to expand your tabs to spaces though.
--
#====}==) #===(==} #====}==) #===(==} {==)===# (=={====# {==)===# (=={====#
>> Jeff Wang Net : hj...@gruc19.nor.chevron.com <<
>> Chevron Petroleum Technology Company Profs : hjiwa (hovmb) <<
>> Geophysical/Geological Applications Phone : (504) 592-6162 <<
>> 935 Gravier Street, Room 1006 Fax : (504) 592-6958 <<
>> New Orleans, Louisiana 70112 Valeo,vales. Die dulci fruimini!! :) <<
#====}==) #===(==} #====}==) #===(==} {==)===# (=={====# {==)===# (=={====#
The "&" key will execute the last substitute command. Strangely, it only
does it once - If your last command was
:s/recieve/receive/g
Then hitting "&" executes
:s/recieve/receive (without the "g")
John Cheevers
chee...@cs.wisc.edu
Boyd Roberts bo...@prl.dec.com
``When the going gets wierd, the weird turn pro...''
FLAME WAR ALERT * FLAME WAR ALERT * FLAME WAR ALERT :-)
Seriously, if vi screws you screen up, there must be some sort of
configuration problem with your terminal. Call the help desk.
--
| David Rowland | The British are using New Zealanders. They must |
| Datamark Intl Ltd | really mean business ! |
| Wellington | - General Rommel During Northern African |
| NEW ZEALAND | Campaign WWII. |
>In VI, is there an easy way to find all lines whose length
>is greater than 80 characters? I realize tabs are a problem but
>let's assume that there are no tabs.
"Easy" is such a subjective term. I make do with this two-fork hack: a
restaurant critic would give it fewer.
:w !cut -c81- | grep -n .
(where the period is a regexp for "any character except newline" and not end
punctuation), though even eighty characters (because an eighty-character line
on an eighty-column screen causes a cursor jump and an empty screen line) are
too many for my purposes and I usually use "79" in that formula rather than
"81".
It's ugly, but it beats the hell out of typing eighty-one periods in a search
pattern.
David W. Tamkin P. O. Box 59297 Northtown Station, Illinois 60659-0297
dattier@{holonet.net|gagme.chi.il.us} CIS: 73720,1570 MCI Mail: 426-1818
>The "&" key will execute the last substitute command. Strangely, it only
>does it once - If your last command was
>
> :s/recieve/receive/g
>
>Then hitting "&" executes
>
> :s/recieve/receive (without the "g")
The & command does lose the flags of the subsitute command that it repeats,
but you can reissue the flags by using ex's & command instead of vi's:
:&g
or if the substitution worked out so well that you want to do it everywhere,
:%&g
<----- WARNING: This is not a flame ----->
Not. What happens if you use a window that is greater than 80
characters wide, i.e. xterm -g66x132. This does not "screw your screen up" and
searching is still necessary.
Just my $0.02.
Chris.
Chris Iacovelli
Member, Technical Staff
Telesciences CO Systems
ciac...@telesciences.com
if (flame)
> /dev/null
fi