[comp.sys.mac] vi for the Mac

sjs1@edsel.UUCP (S Starr) (10/20/88)

A few weeks ago I had the temerity to ask whether "vi" was available on
the Mac. Just when I had begun to despair of helpful responses (I'm not
counting some early snotty and condescending replies of Mac devotees who
were bemused, perplexed, and/or insulted at the very NOTION of vi on a
Mac), comp.sys.mac became inexplicably unavailable on my UNIX host. So
I've been away from the correspondence for a while, and have just been
catching up. The quality of replies has definitely improved. Also,
I no longer feel like a leper; there are clearly others who'd appreciate
something like vi on the Mac.

Quite a few of the correspondents wonder what vi could possibly offer 
that a good Mac (windows, menus, mice) editor doesn't. Here is what I 
wanted in the first place.

1. Moded (yes, moded!) editing. Emacs users aside, human factors studies
   have been done that show little difference in speed of learning or 
   speed of editing (once learned) between vi (moded) and emacs 
   (modeless) editors. To a large extent, you like what you learned
   first, and I happened to learn vi. But the reason I chose to learn
   vi instead of emacs was that it suited my style of composition;
   I spend a while writing, and then I spend a while changing what
   I wrote. Also, I found vi's command mnemonics to be easier to
   remember than emacs's (really, there's no need whatever to reply
   to that opinion).
2. Non-mouse editing. I have no doubt at all that I can navigate
   and modify a screen much more deftly than can most mouse user with 
   vi's easily accessible cursor movement and pattern matching commands.
   Maybe I'm just a great typist; I don't know. But I don't need to
   take my hands off the keyboard to navigate with vi, and I rarely
   have to even chord-key; it's a convenience I appreciate.
3. Pattern matching and (with underlying "ex") global modification
   capabilities.
4. I was sure hoping that any vi-like editor that ran on a Mac
	would also have some mouse-driven capabilities (cut and paste,
	at least), perhaps menus, perhaps multiple windows. I wasn't
	aware that these were entirely incompatible with the other features.
	Are they, really?

Steven Starr
AT&T Bell Laboratories
184 Liberty Corner Road
Warren, NJ

tim@hoptoad.uucp (Tim Maroney) (10/20/88)

In article <442@edsel.UUCP> sjs1@edsel.UUCP (S Starr) writes:
>1. Moded (yes, moded!) editing. Emacs users aside, human factors studies
>   have been done that show little difference in speed of learning or 
>   speed of editing (once learned) between vi (moded) and emacs 
>   (modeless) editors.

The reason modelessness is mandated in the Mac has nothing to do with the
learning time.  I'm not surprised no difference was found between old-style
modal and modeless editors' learning time, since the bottleneck there is
memorizing a large command set, not modality.

The reason Mac applications are supposed to be non-modal is error prevention.
Even experienced vi users often find themselves giving commands in insert
mode or typing text in command mode.

>2. Non-mouse editing. I have no doubt at all that I can navigate
>   and modify a screen much more deftly than can most mouse user with 
>   vi's easily accessible cursor movement and pattern matching commands.
>   Maybe I'm just a great typist; I don't know. But I don't need to
>   take my hands off the keyboard to navigate with vi, and I rarely
>   have to even chord-key; it's a convenience I appreciate.

The Mac has had arrow keys for quite a while now.  Unfortunately, not all
editors have MPW's extensions of the arrow key command set, but in MPW or
TOPS Terminal, I never have to take my hands from the keyboard to get
around.  As for bottlecap keys, I prefer typing Command-F to first striking
Escape and then striking slash to search for something.  One slightly more
complicated action beats out two slightly simpler actions in real cost.

>3. Pattern matching and (with underlying "ex") global modification
>   capabilities.

As has been pointed out over and over, Mac editors like MPW, Capps, and QUED
have equally powerful features.  (I didn't have time to put regular expression
matching into TOPS Terminal, unfortunately.)
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
"I see little divinity about them or you.  You talk to me of Christianity
 when you are in the act of hanging your enemies.  Was there ever such
 blasphemous nonsense!" - Shaw, "The Devil's Disciple"

rudolph@m.cs.uiuc.edu (10/22/88)

While in general I certainly prefer Mac style editing to vi, there is one vi
feature I find extremely useful which has yet to show up in any Mac editor I
have seen, and that is the ability to mark a location and quickly return to
it.  It's a simple two keystroke command in vi ('m' followed by a letter to
name the mark), and returning is another 2 stroke command.  It's very useful
in navigating large programs, or any large documents for that matter.  
Anyone have any idea why it hasn't been implemented in any major editors, or
know of any that do have it?

strausd@ladder.cs.orst.edu (Douglas E. Strauss) (10/25/88)

In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
>
>While in general I certainly prefer Mac style editing to vi, there is one vi
>feature I find extremely useful which has yet to show up in any Mac editor I
>have seen, and that is the ability to mark a location and quickly return to
>it.  It's a simple two keystroke command in vi ('m' followed by a letter to
>name the mark), and returning is another 2 stroke command.  It's very useful
>in navigating large programs, or any large documents for that matter.  
>Anyone have any idea why it hasn't been implemented in any major editors, or
>know of any that do have it?

What about trying search/find in Word of hidden text, haven't tried it but seemslike could work provided you rember the text and is unambigous.

tim@hoptoad.uucp (Tim Maroney) (10/26/88)

In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
>
>While in general I certainly prefer Mac style editing to vi, there is one vi
>feature I find extremely useful which has yet to show up in any Mac editor I
>have seen, and that is the ability to mark a location and quickly return to
>it.

MPW Shell has it.

I'd prefer the system to keep a list of recent locations automatically,
and you could then bring up the list with a command-key shortcut and select
in it.  A few lines of surrounding context would suffice.  This seems much
more Mac-like, and parallels a HyperCard feature to boot.
-- 
Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim
These are not my opinions, those of my ex-employers, my old schools, my
relatives, my friends, or really any rational person whatsoever.

jurjen@cwi.nl (Jurjen N.E. Bos) (10/26/88)

In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
>
>While in general I certainly prefer Mac style editing to vi, there is one vi

>[remark that vi can mark locations and jump to them]

>Anyone have any idea why it hasn't been implemented in any major editors, or
>know of any that do have it?

Why?  I think the main reason for having marks it the ability to quickly
jump to a certain part of the file.  I find the scroll bar to the right
easier to use, faster, and more powerful.  I never want to _exactly_ jump
to an earlier location, only to about the same place.  A scroll bar is just
what I need.
-- 
  -- Jurjen N.E. Bos (jurjen@cwi.nl)

steve@violet.berkeley.edu (Steve Goldfield) (10/26/88)

In article <7680@boring.cwi.nl> jurjen@cwi.nl (Jurjen N.E. Bos) writes:
#>In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
#>>
#>>While in general I certainly prefer Mac style editing to vi, there is one vi
#>
#>>[remark that vi can mark locations and jump to them]
#>
#>>Anyone have any idea why it hasn't been implemented in any major editors, or
#>>know of any that do have it?
#>
#>Why?  I think the main reason for having marks it the ability to quickly
#>jump to a certain part of the file.  I find the scroll bar to the right
#>easier to use, faster, and more powerful.  I never want to _exactly_ jump
#>to an earlier location, only to about the same place.  A scroll bar is just
#>what I need.
#>-- 
#>  -- Jurjen N.E. Bos (jurjen@cwi.nl)

It seems that you don't do much cut and paste editing. Many's the
time I want to move a block of text from page 12 to page 5 and
wish I could type '' to jump back and forth. To use the scroll
bar, I have to remove my hands from the keyboard, pick up the
mouse, and scroll two or three times until the appropriate screen
is visible. Then I have to click on the correct location. Let's
face it: a mouse is very handy for many kinds of graphical
manipulations. But for precise editing of text, it is frequently much
more cumbersome than a command editor. Anyone who has ever had to
drag two or three times to select just the text to be changed
knows what I mean.

Steve Goldfield

dorourke@polyslo.CalPoly.EDU (David M. O'Rourke) (10/26/88)

In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
>Anyone have any idea why it hasn't been implemented in any major editors, or
>know of any that do have it?

  MPW offers marking capabilities.  You can mark text from with in scripts
& a nice user interface from with in the editor itself.
-- 
David M. O'Rourke                                  dorourke@polyslo.calpoly.edu

"If it doesn't do Windows, then it's not a computer!!!"
Disclaimer: I don't represent the school.  All opinions are mine!

jamesm@sco.COM (James M. Moore) (10/27/88)

Microsoft Word does this with the 0 key on the keypad.

-- 
** James Moore **
** Internet:  jamesm@sco.com **
** uucp:  {decvax!microsoft | uunet | ucbvax!ucscc | amd}!sco!jamesm **
** Nil clu no suim ar bith ag SCO ceard a bhfuil me ag scriobh anois. **

lippin@skippy.berkeley.edu (The Apathist) (10/27/88)

FullWrite has a useful-looking "bookmarks" feature, which may be what
you're looking for.  Unfortunately, it's not for editing programs.

(Now, a program editor with the appropriate features of FW -- I can
hardly wait for someone to write it.  And integrate it into LSC.)

					--Tom Lippincott
					..ucbvax!math!lippin

		"It's life, Jim, but not as we know it."

jkjl@munnari.oz (John Lim) (10/27/88)

In article <5751@hoptoad.uucp> tim@hoptoad.UUCP (Tim Maroney) writes:
>In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
>>
>>While in general I certainly prefer Mac style editing to vi, there is one vi
>>feature I find extremely useful which has yet to show up in any Mac editor I
>>have seen, and that is the ability to mark a location and quickly return to
>>it.
>
>MPW Shell has it.

So has QUED 2.03. And it uses real mnemonics also, not numbers !!!!

	john lim

borton@uva.UUCP (Chris Borton) (10/27/88)

In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
>While in general I certainly prefer Mac style editing to vi, there is one vi
>feature I find extremely useful which has yet to show up in any Mac editor I
>have seen, and that is the ability to mark a location and quickly return to
>it.  It's a simple two keystroke command in vi ('m' followed by a letter to
>name the mark), and returning is another 2 stroke command.  It's very useful
>in navigating large programs, or any large documents for that matter.  
>Anyone have any idea why it hasn't been implemented in any major editors, or
>know of any that do have it?

QUED has Markers, which do just that.  Make a marker anywhere and it then
shows up in the menu.  Select it and zap, you're back.  You can make these
cmd-key equivalents as well.

Nisus includes this feature too, and I found it invaluable for flipping
between chapters, for instance.

-cbb
-- 
Chris Borton	borton%uva@mcvax.{nl,bitnet,uucp} 
Rotary Scholar, University of Amsterdam CS

kehr@felix.UUCP (Shirley Kehr) (10/27/88)

In article <16029@agate.BERKELEY.EDU> steve@violet.berkeley.edu (Steve Goldfield) writes:
>In article <7680@boring.cwi.nl> jurjen@cwi.nl (Jurjen N.E. Bos) writes:
>#>In article <8400037@m.cs.uiuc.edu> rudolph@m.cs.uiuc.edu writes:
>#>>
>#>>While in general I certainly prefer Mac style editing to vi, there is one vi
>#>
>#>>[remark that vi can mark locations and jump to them]
>#>
>#>>Anyone have any idea why it hasn't been implemented in any major editors, or
>#>>know of any that do have it?
>#>
>#>Why?  I think the main reason for having marks it the ability to quickly
>#>jump to a certain part of the file.  I find the scroll bar to the right
>#>easier to use, faster, and more powerful.  I never want to _exactly_ jump
>#>to an earlier location, only to about the same place.  A scroll bar is just
>#>what I need.
>#>-- 
>#>  -- Jurjen N.E. Bos (jurjen@cwi.nl)
>
>It seems that you don't do much cut and paste editing. Many's the
>time I want to move a block of text from page 12 to page 5 and
>wish I could type '' to jump back and forth. To use the scroll
>bar, I have to remove my hands from the keyboard, pick up the
>mouse, and scroll two or three times until the appropriate screen
>is visible. Then I have to click on the correct location. Let's
>face it: a mouse is very handy for many kinds of graphical
>manipulations. But for precise editing of text, it is frequently much
>more cumbersome than a command editor. Anyone who has ever had to
>drag two or three times to select just the text to be changed
>knows what I mean.
>
>Steve Goldfield

I don't know what kind of application we're talking about anymore. The
original posting referred to an "editor" which I assumed was different
from a word processor. 

But now, the talk seems to have gravitated to how to get around quickly in
large documents with page numbers, which seems like we're discussing how
to use the mouse in a word processor.

So now, it may depend upon which word processor you use. Getting around and
selecting text using either the mouse or keyboard commands seems like one
of Word's strong points to me. I watch many people here try to drag across
text to select it, but if you spend just a little more effort to learn a
few more selection techniques, you can go pretty fast.

For example, I watched my boss position at the end of a word and hit the
backspace for each character yesterday. I asked him if he couldn't just
double click the word in PageMaker and he didn't know until he tried it.

I regularly command-click sentences in Word, then touch the move key (program-
med with QuickKeys), click on the insertion point, and press Return. Selecting
paragraphs with a double click at its left side seems pretty fast. Once you 
select one word, sentece, or paragraph, dragging automatically moves by the
same amount (word, sentence, or paragraph).

As for positioning, someone suggested putting in what in effect would be
bookmarks in hidden text which you could go to quickly using search. Word
also lets you use the zero on the keypad to quickly go back to the last
place you edited, so it doesn't take too much effort to touch any key to
mark a spot, go get the text you want to move, then touch zero to immediately
be right back there.

Obviously, I've decided to invest a little time in learning how to get
around and select text quickly in Word. If the Mac had a vi style editor
it would probably take longer to learn that - at least for most people. In
fact one look at FullWrite's key commands told me It would be difficult to
use because there is no beginning of line and end of line key command. Those
are my most used positioning commands (1 and 7 on the keypad).

I guess it's really true: for the most part you love what you learned first
and compare everything else to what you already know how to do, rather than
spend a little time learning new techniques. I'm doing the same thing with vi
(which I have to use to write this, but which I've been unwilling to invest
the time to learn more than the arrow keys and e to skip by word).

Shirley Kehr

G.GBERT@LEAR.STANFORD.EDU (Gregory Hulbert) (10/27/88)

If you are looking for a text editor (as opposed to a full blown
word processor), buy QUED/M. It is by far the best text editor
on the market for the Mac. It easily lets you put marks in
your text, including a null mark that is jumped to by
using command-`. Plus, the marks are saved when you save the file.
This is very handy to jump back to places of interest when
you need to run another program. In addition, QUED/M supports
a powerful grep-like search utility, and can search unopened
files as well as opened files. Not least is its macro language
to add to a menu bar often-used keystrokes.
QUED/M is a product of Paragon Concepts, Inc.
It is a great program; I have no vested interest in the company.

Greg Hulbert
g.gbert@lear.stanford.edu
-------

dorourke@polyslo.CalPoly.EDU (David M. O'Rourke) (10/28/88)

In article <16037@agate.BERKELEY.EDU> lippin@math.berkeley.edu writes:
>(Now, a program editor with the appropriate features of FW -- I can
>hardly wait for someone to write it.  And integrate it into LSC.)

  What feature's are you looking for.  As far as integrating it into LSC I
don't know about that.  But I've found QUED/M to be more than enough power for
most any editing needs.  Too bad it's not integrated into MPW :-(.
-- 
David M. O'Rourke                                  dorourke@polyslo.calpoly.edu

"If it doesn't do Windows, then it's not a computer!!!"
Disclaimer: I don't represent the school.  All opinions are mine!

blm@cxsea.UUCP (Brian Matthews) (10/28/88)

rudolph@m.cs.uiuc.edu writes:
|While in general I certainly prefer Mac style editing to vi, there is one vi
|feature I find extremely useful which has yet to show up in any Mac editor I
|have seen, and that is the ability to mark a location and quickly return to
|it.

QUED and MPW Shell both do this.  QUED has any number of named marks, and
one special mark which gets exchanged with the current location with
command-`.  I would suspect Nissus would have the same thing.

-- 
Brian L. Matthews  blm@cxsea.UUCP   ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm
+1 206 251 6811    Computer X Inc. - a division of Motorola New Enterprises

uh@bsiao.UUCP (Uul Haanstra) (10/31/88)

in article <16029@agate.BERKELEY.EDU>, steve@violet.berkeley.edu (Steve Goldfield) says:
> ...
> wish I could type '' to jump back and forth. To use the scroll
> ...

In Word (3.01), try the 0 (zero) on the numeric keypad. It'll switch 
you between two places.
-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Uul Haanstra, Postbank N.V. Amsterdam                ...!mcvax!bsiao!uh
              Pb 21009
	      1000 EX AMSTERDAM                         +31-20 584 3312

mcnabb@m.cs.uiuc.edu (11/01/88)

I am probably using an old version of QUED, but...
While I CAN mark text and instantly return to it, I CANNOT do things like:

     "delete all lines between mark-a and mark-b"
or
     "only between lines mark-a and mark-b, substitute this string for that"
etc.

Have I missed something in this vi .vs. QUED discussion? (... maybe I'm
just a very naive QUED user?)  Having marks correspond to places within
lines rather than just beginnings of lines plus vi's *complete* mark-usage
functionality would be dandy.