'vi +/mail .login' not on SUN ?? - (nf)

dce at mips.UUCP dce at mips.UUCP
Mon Oct 27 01:57:45 AEST 1986


In article <38400002 at pbinfo.UUCP> michael at 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



More information about the Comp.unix.wizards mailing list