[net.unix-wizards] 'vi +/mail .login' not on SUN ??

michael@pbinfo.UUCP (10/22/86)

	What is wrong?

I tried on a SUN 3 to invoke the 'vi' (only for fun(:-) with
the command

	vi +/mail .login

which should (I think) bring up 'vi' with my .login and place
me to the first occurrence of the word "mail". Surprise!! It
said something like 'hit bottom without finding matching pattern',
although this word is definitively in my .login. (I invoked 'vi'
with 'vi .login' and did a '/mail', worked perfect.) I fiddled a 
little with " and ', but the result remained the same.

	So, who is wrong: The SUN or I ??

	Michael Schmidt

UUCP:  ...!seismo!unido!pbinfo!michael     |  Post: Michael Schmidt
       or michael@pbinfo.UUCP              |        Universitaet-GH Paderborn
                                           |        FB 17 - Informatik
CSNET: michael%pbinfo.uucp@Germany.CSNET   |        Warburger Str. 100
                                           |        D-4790 Paderborn
ARPA:  michael%pbinfo.uucp@seismo.css.gov  |        West Germany

michael@pbinfo.UUCP (10/25/86)

        Things have been cleared:

	vi starts up executing commands given by '+' on the last
	line. I had a 'set nowrapscan' in my EXINIT environment
	variable, so the search must hit the bottom immediately.

	Strange, but real.

	Michael

dce@mips.UUCP (10/26/86)

In article <38400002@pbinfo.UUCP> michael@pbinfo.UUCP writes:
>
>	What is wrong?
>
>I tried on a SUN 3 to invoke the 'vi' (only for fun(:-) with
>the command
>
>	vi +/mail .login
>
>which should (I think) bring up 'vi' with my .login and place
>me to the first occurrence of the word "mail". Surprise!! It
>said something like 'hit bottom without finding matching pattern',
>although this word is definitively in my .login. (I invoked 'vi'
>with 'vi .login' and did a '/mail', worked perfect.) I fiddled a 
>little with " and ', but the result remained the same.
>
>	So, who is wrong: The SUN or I ??
>
>	Michael Schmidt

(I replied directly to Michael, but thought others might be interested.)

When the '+/mail' command is executed, the editor is in 'ex' mode. That
is, it's the same as having executed ex on the file and typing the command
/mail. Now, when the editor starts up in ex mode, the current line is
at the end of the file, so the search starts there. If the option
nowrapscan is set, the search will stop (with the 'hit bottom' message
if nothing is found) at the bottom of the file.

I suspect that either:

	1. Michael has nowrapscan set in his .exrc or EXINIT, or
	2. SUN vi sets nowrapscan by default

In any event, the 'most correct' syntax for starting up vi from a pattern
can be discovered by running /usr/ucb/error with the -v option (you have
to have some errors to incorporate into a file). This syntax is

	vi '+1;/pattern' file

			David Elliott
			decwrl!mips!dce

guy@sun.UUCP (10/27/86)

> I suspect that either:
> 
> 	1. Michael has nowrapscan set in his .exrc or EXINIT, or
> 	2. SUN vi sets nowrapscan by default

I can narrow that down further; 2) isn't the case, since our "vi" is pretty
much the same as everybody else's (I tried something equivalent to what the
original poster was trying to do, and it worked fine), so he must have set
"nowrapscan".
-- 
	Guy Harris
	{ihnp4, decvax, seismo, decwrl, ...}!sun!guy
	guy@sun.com (or guy@sun.arpa)

mac@esl.UUCP (10/29/86)

In article <732@mips.UUCP> dce@mips.UUCP (David Elliott) writes:
>In article <38400002@pbinfo.UUCP> michael@pbinfo.UUCP writes:
>>
>>	What is wrong?
>>
>>I tried on a SUN 3 to invoke the 'vi' (only for fun(:-) with
>>the command
>>
>>	vi +/mail .login
>>
>>which should (I think) bring up 'vi' with my .login and place
>>me to the first occurrence of the word "mail". Surprise!! It
>>said something like 'hit bottom without finding matching pattern',
>>although this word is definitively in my .login. (I invoked 'vi'
>>with 'vi .login' and did a '/mail', worked perfect.) I fiddled a 
>>little with " and ', but the result remained the same.
>>
>>	So, who is wrong: The SUN or I ??
>>
>>	Michael Schmidt
>
>
>When the '+/mail' command is executed, the editor is in 'ex' mode. That
>is, it's the same as having executed ex on the file and typing the command
>/mail. Now, when the editor starts up in ex mode, the current line is
>at the end of the file, so the search starts there. If the option
>nowrapscan is set, the search will stop (with the 'hit bottom' message
>if nothing is found) at the bottom of the file.
>
>	vi '+1;/pattern' file
>
>			David Elliott
>			decwrl!mips!dce

	Or vi +\?mail .login
	 (if all he wanted was a line with mail, rather than the First line
	 with mail.  Saves 3 characters (note the ; requires the ''s)
-- 
------------------------------------+-----------------------------------------+
| Michael Mc Namara                 |  MM MM MM    OO   SSS   AAA   II  CCCC  |
| ESL Incorporated                  |   M   M  M  O  O S         A   I C    C |
| ARPA: mac%esl.UUCP@ames.ARPA      |   M   M  M  O  O  SSS   AAAA   I C      |
|       mac%esl.UUCP@shasta.ARPA    |   M   M  M  O  O     S A   A   I C    C |
|       mac%esl.UUCP@lll-lcc.ARPA   |  MM   M  M   OO   SSS   AAA A III CCCC  |
------------------------------------+-----------------------------------------+
| Note: esl used to be called tflop; the path mac%tflop will still work awhile|
------------------------------------+-----------------------------------------+

rep@genrad.UUCP (Pete Peterson) (10/30/86)

In article <38400002@pbinfo.UUCP> michael@pbinfo.UUCP writes:
	>
	>	What is wrong?
	>
	>I tried on a SUN 3 to invoke the 'vi' the command
	>	vi +/mail .login
	>which should (I think) bring up 'vi' with my .login and place
	>me to the first occurrence of the word "mail". Surprise!! It
	>said something like 'hit bottom without finding matching pattern',

It works on my Sun 2 running "Sun Unix Version 4.2 Release 3.0" and
vi/ex "Version 3.7, 6/10/83".

		pete peterson