[comp.editors] SunOS 4.1 & vi

sinclair@cs.glasgow.ac.uk (Duncan Sinclair) (09/07/90)

We've just upgraded to SunOs 4.1.

Two quick questions for the vi hackers out there:

1) What is the difference between the (sys 5) SunOS 4.1 vi and
   the old (bsd) SunOS 4.0.x vi?   (except "showmode")

2) Is there any way to persuade vi not to use tabs to indent?

Follow-ups to anywhere, I think I read this group.


Thanks,

Duncan.



-- 
Duncan Sinclair                     |  Try one    sinclair@cs.glasgow.ac.uk
Computing Science Research Student  |  of these:  sinclair@uk.ac.glasgow.cs
University of Glasgow               |..!mcsun!ukc!uk.ac.glasgow.cs!sinclair
Quote: "It takes a smart man to know when he's stupid." -- Barney Rubble

hansm@cs.kun.nl (Hans Mulder) (09/11/90)

In article <6246@vanuata.cs.glasgow.ac.uk> sinclair@cs.glasgow.ac.uk (Duncan Sinclair) writes:
>We've just upgraded to SunOs 4.1.
>
>Two quick questions for the vi hackers out there:
>
>1) What is the difference between the (sys 5) SunOS 4.1 vi and
>   the old (bsd) SunOS 4.0.x vi?   (except "showmode")

The one that stung me immediately was that the sys5 version looks at the
environment variable TERMINFO, while the BSD version looks at TERMCAP.

SunOS 4.1 comes with a termcap-to-terminfo converter, but you definitely
notice that you have to invoke it before being able to use vi to edit
your private termcap file to suit the tastes of the converter.

Since you are asking hacker's advice, I suppose you don't want to hear
about "novice" mode.

There must be other differences lurking somewhere.


>2) Is there any way to persuade vi not to use tabs to indent?

Well, you could :set tabstop=1234.  This puts the first tabstop in
column 1234 and since the maximum line length is 1024, you can't get
in column 1234 and vi will never generate a tab.  On the other hand,
vi will get mad if it finds a tab in your file.

Me?  I filter my file through expand every so often.  But I know that
one day I'll forget it and troff will munge my output and I won't
notice until the xerox shop delivers 1000 copies of the disaster....


Happy hacking,

Hans Mulder	hansm@cs.kun.nl

guy@auspex.auspex.com (Guy Harris) (09/13/90)

>There must be other differences lurking somewhere.

The one that motivated the switchover is that the S5R3.1 version (upon
which the SunOS one is based) supports 8-bit character sets.

Here's an edited version of the "ex.news" file in the S5R3.1 source
directory - edited to remove stuff that either isn't in the SunOS 4.1
version, or that was already in the SunOS 4.1 version, or that isn't
relevant (i.e., changes to the source directory names).  Some stuff,
anyway; others may or may not be there (the 4.2BSD version was version
3.7; the 4.3BSD version is still called 3.7, but has some additional
stuff).  Also, stuff such as the "tag stack" stuff that was in the SunOS
version but not the BSD version was propagated into the 4.1 version.

	3. The structure of /usr/preserve has been changed to improve security.
	   The directory /usr/preserve will have read-write-execute permissions
	   for everybody.  Recovered files will be saved in a subdirectory in
	   /usr/preserve.  The subdirectory name is the same as the user's id,
	   owned by the user, and has read-write-execute permissions for the
	   user only.  The recovered file in the subdirectory has read-write
	   permissions for the user only.  Expreserve, exrecover, and /usr/preserve
	   all have owner and group of "bin"; setuid bits in expreserve and
	   exrecover have been turned off.

	4. the command "vi -r" or "vi -L" used to list recoverable files,
	   now lists the user's files found in /tmp as well as /usr/preserve/user
	   so the user has a complete list.  Files are listed under the
	   appropriate directory names.

	6. exit code of ex/vi reflects number of error/warning messages
	   incurred

	7. ctags (used in conjunction with -t option and ":ta") now
	   installed in /usr/bin/ctags (manual page in Section 1).

	8. added ed-like enhancement such that "s/text/%" will replace
	   "text" with the righthand side of the previous substitute
	   command.

	9. added argument to case operator "~" so that multiple substitutions
	   per line can occur (e.g. "10~").

   BUG FIXES:

	1.*if input being read by source'd file and an error is
	   encountered, the user is bumped up to the previous source
	   level, instead of being thrown back into command mode.
	2.*ex/vi restores tty state if fork fails.
	3.*ex/vi allows backspacing and retyping of conditional
	   responses (in the case of ":s/old/new/c").
	4.*"U" (undo line changes) no longer marks file as modified
	   when no editing has been done.
	5.*file not automatically considered modified when "vi +cmd file"
	   syntax used.
	6.*actions of "ZZ" altered as follows:

		COMMAND		      OLD ACTIONS	NEW ACTIONS
		-------		      -----------	-----------
		vi newfn; ZZ	      no file created	same as old action
		vi oldfn; ZZ	      oldfn unchanged	same as old action
		vi newfn; 1,$d; ZZ    no file created	write empty file 
		vi newfn; a text		         (0 char; 0 bytes)
		  1,$d; ZZ	      no file created	write empty file
		vi oldfn; 1,$d; ZZ    oldfn unchanged	write empty file
		vi oldfn; a text;
		 1,$d; ZZ	      oldfn unchanged	write empty file
		vi oldfn; dd all; ZZ  write empty file	same as old action@

	7.*cursor now moves to column 1 when HOME arrow key pushed in
	   INSERT mode.
	8.*if showmode set, it will display APPEND/INSERT/REPLACE(etc.) mode
	   as appropriate.
	9.*"novice" option can now be set or unset properly.
       10.*yank-put now works when wrapmargin set and user tries to
	   do a put at the end of a line (i.e., overlapping the wrap
	   margin).  Similar problem also fixed for ":R" for replacements
	   beyond 80 columns or overlapping wrap margins (whichever comes
	   first).
       11.*stop "!" from being expanded  within the shell escaped command
	   line.  Now ":!!" or any "!!" (after the initial shell escape)
	   will cause substitution of the last command.
       12.*code fixed to allow hardtabs set to 0.  Now, if hardtabs set
	   to 0 (i.e., terminal does not support hardtabs), ex/vi will
	   use spaces to emulate tabbing.
       13.*marks no longer lost after undo
       14.*Note that the REPORT variable is 5 by default. For informatory
	   messages when changes have been make for fewer than 5 lines,
	   the user should ":set report=x" where x is a number.
       15.*"/" no longer considered a command (for undo purposes)
       16.*read done by ":Nr file" command  (where N is a line number)
	   now correctly undone (by "undo" command)
       17.*added boundary checks so that exceeding maximum permitted map
	   statements does not generate core dump/infinite loops
       18.*terminal-dependent mapping removed when the user redefines the
	   terminal by "set term=xxx" from ex editor (i.e., so only one
	   terminal is mapped).
       19.*'w' (advance a word) no longer fails on lines with trailing spaces.
       20.*newline character not added to empty file.
       21.*showmode indicator remains on when arrow keys used (e.g., while in
	   input mode, INPUT MODE indicator is on until the ESC key is pressed).
       22.*an interrupt during a write operation will no longer cause truncated
	   file with no backup (happened only if file had NOT been modified
	   during edit session; otherwise, backup was automatically initiated).
       25.*abbreviations fixed so they do not loop recursively 
	   (i.e., ab yes yes!, or ab O O'Connal).
       26.*J, 1J and 2J perform same operation: joining the current line and
	   the next line together. 0J is actually two commands: 0 (meaning
	   go to the beginning of the line) and J (join).
       27.*when tmp file becomes too big, line of garbage no longer added to
 	   file. 
       28.*":n +command" no longer infinite loops on 3b2's.
       29.*%-matching is now interruptible.

Version 3.9  February 10, 1983

	A new option "showmode" (smd) causes input mode to be indicated
	toward the right end of the message line.  This is useful for
	learning vi and for people who get confused about what mode they
	are in.  Only the first letter of the message is shown if "terse"
	is also set.

	A new invocation "vedit" is for novices.  This is like edit but
	puts you into visual mode right away.  It also sets showmode.

	The default number of lines to scroll in visual mode on a
	control D is now the variable scroll, not half the variable
	window.

	A bug causing extra CPU usage when vi is reentered after ^Z
	has been fixed.  This also fixes a bug causing a hang until the
	user types something if you are past column 80 before ^Z.

Version 3.8  April 22, 1982

	The main change is conversion from termcap to terminfo.

	More function keys are supported now.  Most function keys
	with a meaning to vi work both in command mode and input mode.

	A bug in the encryption command causing plain text in the
	temp file and encrypted text on your screen has been fixed.

	A new command "crypt" or "X" enters encryption mode once
	you have started editing, like the ed "x" command.

	A new command line option "-V" (verbose) is useful for
	debugging ex scripts.

	A new boolean set option "flash" allows you to control whether
	vi uses the visible bell in your terminal (if it has one).
	The default is "flash", do "set noflash" if the flashing
	is annoying.

	The "open" boolean option has been deleted.  Ex will no longer
	prevent the user from entering open mode.  This clears up problems
	with paths and invocations containing the letter "d".

	If the local system has the Cornell "Fast Timer" driver, vi uses
	it instead of alarm to detect function keys.  This means that the
	delay after typing escape will usually only be 0.1 second instead
	of a full second.  Of course, if the user continues typing, there
	is no delay at all.

asherman@dino.ulowell.edu (Aaron Sherman) (09/13/90)

sinclair@cs.glasgow.ac.uk (Duncan Sinclair) writes:

   We've just upgraded to SunOs 4.1.

   Two quick questions for the vi hackers out there:

   1) What is the difference between the (sys 5) SunOS 4.1 vi and
      the old (bsd) SunOS 4.0.x vi?   (except "showmode")

The most notible for me was that the man-page is wrong. I looked at the
man-page, and it said that -x would ecrypt with a prompt for the key.
Well, not only does this no-longer work, but the usage string that gets 
printed out is VERY different from the manual-page.

   2) Is there any way to persuade vi not to use tabs to indent?

Not that I know of. Use expand.


			-AJS

--
asherman@dino.ulowell.edu	or	asherman%cpe@swan.ulowell.edu
Note that as of 7/18/90 that's asherman@dino.cpe.ulowell.edu
"That that is is that that is not is not is that it it is."

maart@cs.vu.nl (Maarten Litmaath) (09/13/90)

In article <4051@auspex.auspex.com>,
	guy@auspex.auspex.com (Guy Harris) writes:
)...
)	9. added argument to case operator "~" so that multiple substitutions
)	   per line can occur (e.g. "10~").

The `~' command should be a _real_ operator, like `c', `d' and `y', so
things like `~w' would work as intended.  Now we're supposed to calculate
the length of the word first.  Sheesh!  :-(
--
     "What is a rabbit?  A particle that makes special tracks in the snow!"
                                (Paul M. Koloc)

guy@auspex.auspex.com (Guy Harris) (09/14/90)

>   1) What is the difference between the (sys 5) SunOS 4.1 vi and
>      the old (bsd) SunOS 4.0.x vi?   (except "showmode")
>
>The most notible for me was that the man-page is wrong. I looked at the
>man-page, and it said that -x would ecrypt with a prompt for the key.
>Well, not only does this no-longer work, but the usage string that gets 
>printed out is VERY different from the manual-page.

You *did* get the US encryption kit for 4.1, right?

If not, that's probably the explanation.  Thanks to an assorted
collection of idiots in the US Government, such high-tech
state-of-the-art sophisticated encryption mechanisms as the one in "ed",
"ex"/"vi", and "crypt" - you know, the one based on the WWII Enigma
machine - are considered "munitions" and require assorted nonsense in
order to be exported. 

Prior to SunOS 4.1, Sun dealt with this by providing "domestic" and
"international" distribution tapes.  In 4.1, Sun dropped the "domestic"
tape, and the 4.1 distributions are all "international" and purged of
such sensitive technology as "crypt".  US customers can get an
"encryption kit" that provides the missing bits; if you didn't get that
kit, your "ex"/"vi" won't support encryption of files.

Of course, the original poster is from the UK, so he can't get it
(legally) anyway.  Sigh....

emcmanus@cs.tcd.ie (Eamonn McManus) (09/14/90)

guy@auspex.auspex.com (Guy Harris) writes:
...
>Here's an edited version of the "ex.news" file in the S5R3.1 source
>directory
...
>	8. added ed-like enhancement such that "s/text/%" will replace
>	   "text" with the righthand side of the previous substitute
>	   command.

How is this different from "s/text/~"?
--
Eamonn McManus <emcmanus@cs.tcd.ie>	<emcmanus%cs.tcd.ie@cunyvm.cuny.edu>
			Fingers are for fuguing.

guy@auspex.auspex.com (Guy Harris) (09/16/90)

 >>	8. added ed-like enhancement such that "s/text/%" will replace
 >>	   "text" with the righthand side of the previous substitute
 >>	   command.
 >
 >How is this different from "s/text/~"?

Beats me, I take pride in knowing as little about how to use "vi" as
I can.  I'm just reporting what the "ex.news" file in the S5R3.1
distribution said....