🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

5 total messages Started by Brant Cheikes Sun, 17 Jul 1988 04:10
bug in vi with :ab
#803
Author: Brant Cheikes
Date: Sun, 17 Jul 1988 04:10
17 lines
1243 bytes
Problem: Abbreviations are expanded at all levels of vi.
This has been reproduced in both System V vi and BSD vi
(SVR2 and 4.3BSD respectively).

Reproduce:  Run vi, and set an abbreviation, say :ab foo FooBaz.
Now insert some text, anytime you type "foo", it will be replaced
by "FooBaz".  This is fine.  However, you can no longer ever search
for the string "foo", nor edit a file called "foo"--in all cases,
"foo" is expanded first to FooBaz.

SO, is this a bug?  Is there some way to search for abbreviation
strings?  If a bug, is there a fix?  It seems to me that abbreviations
should ONLY be expanded while in input mode.
--
Brant Cheikes
Department of Computer and Information Science
ARPA: brant@linc.cis.upenn.edu, UUCP: {bpa,drexel}!manta!brant
Re: bug in vi with :ab
#804
Author: Daniel R. Levy
Date: Sun, 17 Jul 1988 18:29
23 lines
1700 bytes
In article <5473@super.upenn.edu>, brant@linc.cis.upenn.edu (Brant Cheikes) writes:
# Problem: Abbreviations are expanded at all levels of vi.
# This has been reproduced in both System V vi and BSD vi
# (SVR2 and 4.3BSD respectively).
# Reproduce:  Run vi, and set an abbreviation, say :ab foo FooBaz.
# Now insert some text, anytime you type "foo", it will be replaced
# by "FooBaz".  This is fine.  However, you can no longer ever search
# for the string "foo", nor edit a file called "foo"--in all cases,
# "foo" is expanded first to FooBaz.
# SO, is this a bug?  Is there some way to search for abbreviation
# strings?  If a bug, is there a fix?  It seems to me that abbreviations
# should ONLY be expanded while in input mode.

"Bug" is in the eye of the beholder, I guess, but yes there is a way to do
what you want.  Hide one of the characters of the abbreviation (except the
first if it is a multi-character abbreviation) with a back-slash, e.g. even
if you have done ":ab foo FooBaz", /f\oo/<RETURN> searches for "foo" and
:vi f\oo<RETURN> edits file "foo" etc.
-- 
|------------Dan Levy------------|  THE OPINIONS EXPRESSED HEREIN ARE MINE ONLY
|    AT&T  Data Systems Group    |  AND ARE NOT TO BE IMPUTED TO AT&T.
|        Skokie, Illinois        | 
|-----Path:  att!ttbcad!levy-----|
Re: bug in vi with :ab
#809
Author: Maarten Litmaath
Date: Tue, 19 Jul 1988 17:02
34 lines
1585 bytes
In article <5473@super.upenn.edu> brant@linc.cis.upenn.edu (Brant Cheikes) writes:
\Problem: Abbreviations are expanded at all levels of vi.
\This has been reproduced in both System V vi and BSD vi
\(SVR2 and 4.3BSD respectively).
\
\Reproduce:  Run vi, and set an abbreviation, say :ab foo FooBaz.
\Now insert some text, anytime you type "foo", it will be replaced
\by "FooBaz".  This is fine.  However, you can no longer ever search
\for the string "foo", nor edit a file called "foo"--in all cases,
\"foo" is expanded first to FooBaz.
\
\SO, is this a bug?  Is there some way to search for abbreviation
\strings?  If a bug, is there a fix?  It seems to me that abbreviations
\should ONLY be expanded while in input mode.

This is a bug indeed.
The same goes for 'map!'.
There are work-arounds however:

	/foo^V.

	and

	/foo^V$

The first will find any occurrence of 'foo' not followed by \n,
the second will find foo at EOL.
The ^V is needed to escape the next 'breakpoint' char.
Edit next file:

	:n foo^V ^J
-- 
I'd rather live in Russia             |Maarten Litmaath @ Free U Amsterdam:
              than in South-Africa... |maart@cs.vu.nl, mcvax!botter!ark!maart
Re: bug in vi with :ab
#810
Author: Evelyn C. Leeper
Date: Wed, 20 Jul 1988 16:44
20 lines
1369 bytes
In article <5473@super.upenn.edu> brant@linc.cis.upenn.edu (Brant Cheikes) writes:
> Problem: Abbreviations are expanded at all levels of vi.  This has been
> reproduced in both System V vi and BSD vi (SVR2 and 4.3BSD respectively).
> 
> Reproduce:  Run vi, and set an abbreviation, say :ab foo FooBaz.  Now insert
> some text, anytime you type "foo", it will be replaced by "FooBaz".  This is
> fine.  However, you can no longer ever search for the string "foo", nor edit a
> file called "foo"--in all cases, "foo" is expanded first to FooBaz.

> SO, is this a bug?  Is there some way to search for abbreviation strings?  If
> a bug, is there a fix?  It seems to me that abbreviations should ONLY be
> expanded while in input mode.

Whether or not it's a bug is a philsophical question.  How to search for the
string "foo" is with "/f.*oo".

					Evelyn C. Leeper
					201-957-2070
				UUCP:	att!mtgzy!ecl or ecl@mtgzy.att.com
				ARPA:	ecl%mtgzy@att.arpa
Re: bug in vi with :ab
#811
Author: Andreas Pleschutznig
Date: Fri, 22 Jul 1988 12:47
35 lines
1701 bytes
In article brant@linc.cis.upenn.edu (Brant Cheikes) writes:

> Problem: Abbreviations are expanded at all levels of vi.
> This has been reproduced in both System V vi and BSD vi
> (SVR2 and 4.3BSD respectively).
> 
> Reproduce:  Run vi, and set an abbreviation, say :ab foo FooBaz.
> Now insert some text, anytime you type "foo", it will be replaced
> by "FooBaz".  This is fine.  However, you can no longer ever search
> for the string "foo", nor edit a file called "foo"--in all cases,
> "foo" is expanded first to FooBaz.
> 
> SO, is this a bug?  Is there some way to search for abbreviation
> strings?  If a bug, is there a fix?  It seems to me that abbreviations
> should ONLY be expanded while in input mode.
> --

Well, I don't think this is really a bug in vi, because if you read the
description of your system carefully, you will notice that there are 
certain char's like '\' to take the special meaning off. Just try the
following

	vi test
	:ab x foo
	x
	x
	x

You will notice, that the 'x' is translated to 'foo'. Now go up and
do 'rx' at a pace you wish to -> Hmmm... The 'x' seems to be in the file
without translation !!!. In the same way, you may edit then a file named
'x' by doing a line like ':e! \x', where the '\' takes off the special meaning of 'x'.

Hope that helps.
andy
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads