hickman (02/10/83)
#R:hou5a:-22200:zinfandel:12400015:000:179 zinfandel!hickman Feb 10 08:56:00 1983 The path name you set "TERMCAP" to must be an absolute path name (that is it must start with a "/"). This feature is actually in the termcap library, not vi... kipp hickman
gregg%a.cs.okstate.edu@RELAY.CS.NET (Gregg Wonderly) (10/03/86)
#define CASE3 3
#define CASE2 2
#define CASE1 1
With all this fuss about editors, I couldn't resist to get in on the
discussion. Most of the complaints seem to center around whether or not
VI(1) is mnemonic. I for one believe that this is not that important for
those who use an editor frequently. Someone else commented to this effect.
Putting that aside, I use VI(1) ONLY for its functionality. It gives me
so many functions that I do not find in other editor's. Not to mention
the fact that I can use my micro from home to edit files while dialed up.
Granted, most other UN*X based editors take advantage of term[cap/info].
The other really BIG plus is Regular Expression searches, and substitutions.
Most people might say "I'd never use that", but I guarantee that I have a
real hard time on other systems which don't have RE's.
Below is my classic example of the power of VI(1). I had to do this once
apon a time when I took over a project that had been coded by some rather
new C programmers. The problem was the switch statement. I needed very much
to have #define macros for the case values in the switch. The printf's in each
switch were already there, and had strings in them that were satisfactory for
the macro names. The map statement below creates a keyboard macro which is
invoked by typing the "q" key while in "command" mode. If you have never used
a keyboard map in VI(1), then you might try this to see what happens. Before
typing "q" the first time, you should enter the command:
/case[ <TAB>]*[0-9]*:<ENTER>
This will initiate a search to locate the first case in the switch below.
You can figure out what the following map does pretty easily. It goes
like this.
1) Move to the text after the text "case". -> W
2) Delete to the ':' character (exclusive of ':'). -> dt:
3) Mark the current position as A. -> ma
4) Go to the top of the file. -> 1G
5) Open a line and insert the text "#define<TAB>". -> O#define<TAB>^V<ESC>
6) Put the case value with the #define. -> p
7) Move back to the position marked as A. -> 'a
8) Move down to the printf(). -> j
9) Move to the " character. -> f"
10) Move to the actual text. -> l
11) Delete the text. -> dt\
12) Put it back. -> P
13) Move back up to the previous line. -> k
14) Move to the beginning of the line. -> 0
15) Move to the ':' character. -> f:
16) Put the macro name text in as CASE value. -> P
17) Move back to the current #define. -> 1G
18) Move past the #define. -> W
19) Put the Macro name in. -> P
20) Append 2 tabs after the name. -> a<TAB><TAB>^V<ESC>
21) Move back to the place marked as A -> 'a
22) Find the next case statement to change. -> n
This is the magical map
-----------------------
<...> denotes a single key to press as in the TAB key, or the ESCAPE key,
and ^V is the CONTROL-V key, which is used to quote control characters that
might otherwise be interpreted. Here, <ESC> needs quoting or else VI will
assume you want to end the map definition. Also note that you must type a
':' from command mode to get into 'EX' command mode where maps are entered.
:map q Wdt:ma1GO#define<TAB>^V<ESC>p'ajf"ldt\Pk0f:P1GWPa<TAB><TAB>^V<ESC>'an
And by the way, undo even works on something like this.
------------------------------------------------------------------------------
switch (i) {
case 1:
printf ("CASE1\n");
func1(p,1,1,1,1,);
break;
case 2:
printf ("CASE2\n");
func1(p,2,1,2,1,);
break;
case 3:
printf ("CASE3\n");
func1(p,1,1,1,1,);
break;
case 4:
printf ("CASE4\n");
func1(p,1,1,1,1,);
break;
case 5:
printf ("CASE5\n");
func1(p,1,1,1,1,);
break;
case 6:
printf ("CASE6\n");
func1(p,1,1,1,1,);
break;
case 7:
printf ("CASE7\n");
func1(p,1,1,1,1,);
break;
case 8:
printf ("CASE8\n");
func1(p,1,1,1,1,);
break;
case 9:
printf ("CASE9\n");
func1(p,1,1,1,1,);
break;
case 10:
printf ("CASE10\n");
func1(p,1,1,1,1,);
break;
}
--------------------------------------------------------------------------
Gregg Wonderly
Department of Computing and Information Sciences
Oklahoma State University
UUCP: {cbosgd, ea, ihnp4, isucs1, mcvax, uokvax}!okstate!gregg
ARPA: gregg%okstate.csnet@CSNET-RELAY.ARPA
or
ARPA: gregg@A.CS.OKSTATE.EDU
campbell@maynard.UUCP (Larry Campbell) (10/04/86)
All this talk of how wonderful and feature-rich vi is must be from people who have never used EMACS. All of the examples cited so far could have been done more easily in EMACS. Contrary to some earlier statements, EMACS does have regular expression searches (at least the two version of EMACS I use, Jove and Gosling's, have them). What's more, vi completely lacks the following features I find indispensable: - multiple buffers and windows - query replace - keyboard macros - online help (":!man vi" doesn't count) I also dislike strongly vi's user interface, but that's not the point. Even if it had an EMACS-like key binding set, it's lack of useful features would still prevent me from using it. The only use I can find for vi is editing the EMACS sources while I'm porting them to a new machine. -- Larry Campbell The Boston Software Works, Inc. ARPA: campbell%maynard.uucp@harvard.ARPA 120 Fulton Street, Boston MA 02109 UUCP: {alliant,wjh12}!maynard!campbell (617) 367-6846
narayan@twg-ap.UUCP (Narayan Mohanram) (10/06/86)
> > What's more, vi completely lacks the following features I find > indispensable: > > - multiple buffers and windows > - query replace > - keyboard macros > - online help (":!man vi" doesn't count) > > Larry Campbell The Boston Software Works, Inc. How about :g/old-string/s//new-string/gc for conditional replace. Or is query replace something different. PS. I am not arguing for either religions. -- Narayan Mohanram Phone: 415-962 7170 ARPANET twg-ap!narayan@lll-tis-b.ARPA Usenet {attunix, ihnp4}!amdahl!twg-ap!narayan USnail The Wollongong Group 1129 San Antonio Road Palo Alto, CA 94303. USA ========================================================= || If you can't lick it, try some whipped cream || =========================================================
bobr@zeus.UUCP (10/06/86)
In article <357@maynard.UUCP> campbell@maynard.UUCP (Larry Campbell) writes: >The only use I can find for vi is editing the EMACS sources while I'm >porting them to a new machine. Here, here! That's about all I ever use vi for also.
campbell@maynard.UUCP (Larry Campbell) (10/07/86)
In article <113@twg-ap.UUCP> narayan@twg-ap.UUCP (Narayan Mohanram) writes: >How about :g/old-string/s//new-string/gc for conditional replace. Or is >query replace something different. Well, you're partly right and I'm partly wrong. My V7 documentation is notoriously skimpy on ex commands. The stuff you mention is a *subset* of query replace -- you get two choices, replace or skip. In EMACS, you get to choose (1) replace, (2) skip, (3) replace this and all subsequent occurrences without asking, (4) get out of this command entirely, (5) enter a recursive edit level (with a mode line indication!), allowing you to edit to your heart's content -- "exiting" the editor resumes the query replace where you left off. And as far as I know, vi still doesn't have mutliple buffers and windows... -- Larry Campbell MCI: LCAMPBELL The Boston Software Works, Inc. ARPA: campbell%maynard.uucp@harvard.ARPA 120 Fulton Street, Boston MA 02109 UUCP: {alliant,wjh12}!maynard!campbell (617) 367-6846
mwm@cuuxb.UUCP (Marc W. Mengel) (10/08/86)
In article <113@twg-ap.UUCP> narayan@twg-ap.UUCP (Narayan Mohanram) writes: >> >> What's more, vi completely lacks the following features I find >> indispensable: >> >> - multiple buffers and windows >> - query replace >> - keyboard macros >> - online help (":!man vi" doesn't count) >> >> Larry Campbell The Boston Software Works, Inc. > >How about :g/old-string/s//new-string/gc for conditional replace. Or is >query replace something different. Not to mention the ":map" and ":map!" commands for keyboard macro's. (It seems to me you could mimic emacs fairly well by immediately going into insert mode, and using a good sprinkling of map! commands in your .exrc...) And one volley for the other side: I really like to be able to say "15j" to go down 15 lines, and "40a -<ESC>" to be able to make an 80 column dashed line. Does Emacs, (or any other editor, for that matter) provide this repeat n times facility? (this is not a rhetorical question, I don't know...) P.S. A Challenge to those Other Editor users, I can write a vi macro to reverse the words on a line... can you? -- Marc Mengel ...!ihnp4!cuuxb!mwm
rpd@f.gp.cs.cmu.edu (Richard Draves) (10/09/86)
Emacs macros are much easier to use than VI macros. With VI, one must imagine the changes to the file to construct the macro. With a complicated macro, this can be very difficult. With Emacs, the definition of the macro is executed as you type it in, so all the effects are apparent. GNU Emacs has reqular expression searches in addition to the normal incremental searching. Rich
chris@umcp-cs.UUCP (Chris Torek) (10/09/86)
>In article <113@twg-ap.UUCP> narayan@twg-ap.UUCP (Narayan Mohanram) writes: >>How about :g/old-string/s//new-string/gc for conditional replace. Or is >>query replace something different. I was ecstatic when I discovered a `confirm' (or `conditional') suffix to substitute operations in vi. (This was before I ever saw Emacs.) Then I found that its implementation was rather flawed. Vi performs the conditional replace by: 1. Printing the line. 2. Printing `^'s below the matched text. 3. Awaiting confirmation: y<RETURN> or n<RETURN> (others presumably equivalent to `no'). 1. and 2. are ugly---but that is not too bad. 3. sounds fine: type `y' or `n'; if you hit the wrong key, use your back-space key to correct it. Naturally, I soon hit the wrong key. I typed control-H (my backspace; I dislike DEL). Vi echoed ^, H. You *cannot* correct a wrong answer here. Why bother waiting for RETURN then? It would be better, I think, not to wait for RETURN, and to accept only `y', `n', and `q' (quit), and perhaps uppercase versions of these. In article <847@cuuxb.UUCP> mwm@cuuxb.UUCP (Marc W. Mengel) writes: >Not to mention the ":map" and ":map!" commands for keyboard macro's. Maps are tricky. You can do a number of things with maps, but not as much as in Emacs. They do often suffice. >And one volley for the other side: I really like to be able to say >"15j" to go down 15 lines, and "40a -<ESC>" to be able to make an >80 column dashed line. Does Emacs, (or any other editor, for that >matter) provide this repeat n times facility? (this is not a >rhetorical question, I don't know...) Yes, `but'. To go down 15 lines, type meta-15 (type 15 while holding down the meta key), or ESC 1 5, or control-U 1 5, then control-N. Making a dashed line is more difficult. Vi has a major advantage over Emacs here. In Emacs, you must announce in advance that you intend to repeat something, do the operation, then say it is done; you can then repeat that operation. (This is much like constructing a map, except that you can see what you are doing.) The problem here is that Emacs repeats only single operations. A single operation can, of course, be a `repeat the remembered operations' operation. Vi too repeats only single operations, but vi has a much better indicator as to what constitutes one operation. One operation is everything done from one trip in the `get command' loop to the next. If I type i, f, o, o, SPACE, ESC, vi knows that the last operation was to insert `foo '. Because Emacs is modeless, it does not have this kind of clue. Vi can then repeat the `insert the word foo' operation, either with a repeat count given in advance (`10ifoo<SP><ESC>') or with a `repeat last command' command (`.........', or `9.'). Emacs's repeat is actually more powerful; it repeats *anything*. There are things you cannot do in vi maps (`put's, e.g., are restricted). But vi's repeat is more convenient, and probably gets used more often. >P.S. A Challenge to those Other Editor users, I can write a vi macro to > reverse the words on a line... can you? I just type meta-control-T in my Emacs. I know rather more than I might wish about both vi and Gosling Emacs. The innards of the latter are considerably cleaner. I believe there are fewer bugs in my (local version of) Emacs than in my (4.3BSD-beta version of) vi. But I use both editors regularly. I pick the one that seems appropriate for the job. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu
campbell@maynard.UUCP (Larry Campbell) (10/10/86)
In article <847@cuuxb.UUCP> mwm@cuuxb.UUCP (Marc W. Mengel) writes: >And one volley for the other side: I really like to be able to say "15j" to >go down 15 lines, and "40a -<ESC>" to be able to make an 80 column dashed line. >Does Emacs, (or any other editor, for that matter) provide this repeat n times >facility? (this is not a rhetorical question, I don't know...) Yes, you say "ESC nn <cmd>" or "CTRL-U nn <cmd>" to do <cmd> nn times. This includes inserting text, so while typing text, I can insert a line of 65 dashes (without having to switch modes twice!) by typing: ESC 6 5 - >P.S. A Challenge to those Other Editor users, I can write a vi macro to > reverse the words on a line... can you? Speaking for EMACS: yes. -- Larry Campbell MCI: LCAMPBELL The Boston Software Works, Inc. ARPA: campbell%maynard.uucp@harvard.ARPA 120 Fulton Street, Boston MA 02109 UUCP: {alliant,wjh12}!maynard!campbell (617) 367-6846
arosen@ulowell.UUCP (Andy Rosen) (10/10/86)
In article <672@zeus.UUCP> bobr@zeus.UUCP (Robert Reed) writes: >In article <357@maynard.UUCP> campbell@maynard.UUCP (Larry Campbell) writes: >>The only use I can find for vi is editing the EMACS sources while I'm >>porting them to a new machine. > >Here, here! That's about all I ever use vi for also. I couldn't live without emacs BUT vi is a lot faster starting up, mainly with small files (at least on the 4 different UN*Xes I've used). So, I always use vi when playing with ~/.login, etc. I always use emacs when doing any kind of software development. UUCP : wanginst!ulowell!arosen disclaimer: USnail: Andy Rosen if ($opinion == liked) then ULowell, Box #3031 set credit = $mine Lowell, Ma 01854 else (set credit = $his ; unset opinion) endif
jbuck@epimass.UUCP (Joe Buck) (10/10/86)
In article <3772@umcp-cs.UUCP> chris@umcp-cs.UUCP (Chris Torek) writes: >>In article <113@twg-ap.UUCP> narayan@twg-ap.UUCP (Narayan Mohanram) writes: >>And one volley for the other side: I really like to be able to say >>"15j" to go down 15 lines, and "40a -<ESC>" to be able to make an >>80 column dashed line. Does Emacs, (or any other editor, for that >>matter) provide this repeat n times facility? (this is not a >>rhetorical question, I don't know...) > >Yes, `but'. To go down 15 lines, type meta-15 (type 15 while holding >down the meta key), or ESC 1 5, or control-U 1 5, then control-N. >Making a dashed line is more difficult. Vi has a major advantage >over Emacs here. I'm surprised at you, Chris. An old Emacs hand like you should know that ESC 8 0 - makes an 80 column dashed line, in four keystrokes instead of the five that vi requires. I use this all the time. In Emacs everything is a command, so in a sense you're always in command mode, rather than always being in insert mode. '-' is just the "insert a -" command. -- - Joe Buck {hplabs,fortune}!oliveb!epimass!jbuck, nsc!csi!epimass!jbuck Entropic Processing, Inc., Cupertino, California
aglew@ccvaxa.UUCP (10/11/86)
.. > EMACS vs. vi > > Not to mention the ":map" and ":map!" commands for keyboard macro's. (It > seems to me you could mimic emacs fairly well by immediately going into > insert mode, and using a good sprinkling of map! commands in your .exrc...) > > And one volley for the other side: I really like to be able to say "15j" to > go down 15 lines, and "40a -<ESC>" to be able to make an 80 column > dashed line. > > Does Emacs, (or any other editor, for that matter) provide this repeat n > times facility? (this is not a rhetorical question, I don't know...) > > P.S. A Challenge to those Other Editor users, I can write a vi macro to > reverse the words on a line... can you? Believe it or not, EMACS has a vi emulation package, that provides the count and composition facilities fairly well - I'll admit, not as well as vi, but good enough for your examples. And making it better is simply a matter of spending a bit more time at the GNU Lisp. Can I write a vi macro to reverse the words on a line? Yes, fairly easily, although the obvious approach would be to go outside to some UNIX tools. Oh, you mean a GNU function? Yes, even more easily. Ever reverse a list as a class exercise in LISP? And this is done inside EMACS, so no process startup time. Here's a challenge for you: I normally start up 4 or 5 sub-shells of my GNU EMACS session every morning. Each with their own buffer for output. I switch between them with two keystrokes, and I never have to remember to type | more, or > file, for commands invoked from the shell. Can you do that in vi? Andy "Krazy" Glew. Gould CSD-Urbana. USEnet: ihnp4!uiucdcs!ccvaxa!aglew 1101 E. University, Urbana, IL 61801 ARPAnet: aglew@gswd-vms
chris@umcp-cs.UUCP (Chris Torek) (10/11/86)
>>>... I really like to be able to say ... "40a -<ESC>" to be able >>>to make an 80 column dashed line. >In article <3772@umcp-cs.UUCP> I wrote: >>Vi has a major advantage over Emacs here. In article <523@epimass.UUCP> jbuck@epimass.UUCP (Joe Buck) replies: >I'm surprised at you, Chris. An old Emacs hand like you should know >that ESC 8 0 - makes an 80 column dashed line, in four keystrokes >instead of the five that vi requires. I use this all the time. In >Emacs everything is a command, so in a sense you're always in command >mode, rather than always being in insert mode. '-' is just the >"insert a -" command. Indeed, ESC 8 0 - inserts eighty `-' characters. That was not what the original poster (>>>) wanted: 4, 0, a, SPACE, -, ESC, inserts 40 pairs of ` -' characters: ---------------------------------------- vs. - - - - - - - - - - - - - - - - - - - - Incidentally, `-' is not an `insert a ``-'' command', since it has to do the appropriate magic to construct negative arguments if typed immediately after ESC. This cannot always be ignored: e.g., ^U k inserts four `k's, but ^U - inserts nothing, instead setting the prefix argument to -4. ^U 4 -, however, inserts four `-' characters. The exact details may vary according to your Emacs variety. (Nice try, Joe. I *do* make mistakes, but this was not one.) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu
mjy@galbp.UUCP (Michael Yoffee) (10/15/86)
......I have used EMACS and VI(1) and have found good and bad reasons justifying the existence/use of both. GOOD REASONS TO USE: =================== 1. EMACS gives us the multiple-edit capablility which is very useful for cut and paste operations. 2. VI(1) gives us the POWERFUL facility of REGULAR EXPRESSIONS that are infinitely(well probably finite) more useful and productive for pattern matching than simple search&replace facilities of other well known editors. 3. EMACS gives us the POWERFUL macro facility. BAD REASONS TO USE: ================== 1. EMACS does NOT have REGULAR EXPRESSIONS which means you must develop your own pseudo-regular expressions via macros which is VERY slow(I experimented with this). 2. VI(1) does NOT give us the multiple-edit capability for cut & paste but, you can yank a region and paste when you enter a new file. 3. VI(1) does NOT give us a macro facility. ......I find that the absence of regular expressions in EMACS causes me to turn to VI(1). The multiple edit capability is a sacrifice but, I don't use it very much anyhow. As for VI(1) and the lack of a macro facility - I use 'SED(1)' or 'AWK(1)' to make up for this loss and I must say that they fill that void EXTREMELY well. Besides, when you leave out something like a macro facility you get a MUCH SMALLER executable which means MUCH QUICKER load&execute time. -- Michael Yoffee Harris / Lanier Computer R&D {akgua,akgub,gatech}!galbp!mjy
chris@umcp-cs.UUCP (Chris Torek) (10/15/86)
>In article <3772@umcp-cs.UUCP> I wrote: [Vi's :g/old/s//new/gc is not so wonderful. Incidentally, :%s/old/new/gc is equivalent, and no doubt faster.] In article <85@lmi-angel.UUCP> gm@lmi-angel.UUCP (Greg McGary) writes: >There are a couple of `best ways' to do conditional substitution that >I've found. ... >* Following vi's `operator-object' command paradigm, choose an operator > that changes text (such as c, C, r, R, s, S) and an object of text > (such as w, W, f, t, ), }) and make the appropriate change. > >* Do a single-line substitution command, leaving the left-hand-side of > substitution blank, thereby reusing your original search pattern. > (e.g. :s//bletch/) Don't append a `g' for global substitute! The former is better; here is why: >Now that you've made the first change, use `n' or `N' to find the next >occurrance of your pattern. If you don't want to change this occurance, >simply issue another `n' or `N' and proceed to the next occurance. If >you do wish to change this one, use vi's `redo' facility to make the >identical change with a single keystroke. If you made the first change >with a single-line substitution command, repeat the substitution with a >`&', if you used an `operator-object' command, repeat it with a `.'. `&' repeats the most recent `:s' substitution. This is a line-oriented command, so if the pattern (or string, if you have set nomagic) appears twice in a line, and you want to change the second occurrence, you are out of luck. Incidentally, vi's `c'hange, `d'elete, and other `directed' commands are not inherently line or character oriented. If you type, e.g., `cw', vi performs a character-oriented change: one word on the current line. If you type `cj', vi performs a line-oriented change: the current and next lines, in their entirety, are replaced. For something that is this hard to explain, it seems remarkably intuitive. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 1516) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@mimsy.umd.edu
jso@edison.UUCP (John Owens) (10/16/86)
In article <523@epimass.UUCP>, jbuck@epimass.UUCP (Joe Buck) writes: > In article <3772@umcp-cs.UUCP> chris@umcp-cs.UUCP (Chris Torek) writes: > >>In article <113@twg-ap.UUCP> narayan@twg-ap.UUCP (Narayan Mohanram) writes: > >>"40a -<ESC>" to be able to make an 80 column dashed line. > >Making a dashed line is more difficult. Vi has a major advantage > >over Emacs here. > I'm surprised at you, Chris. An old Emacs hand like you should know > that ESC 8 0 - makes an 80 column dashed line [....] > - Joe Buck {hplabs,fortune}!oliveb!epimass!jbuck, nsc!csi!epimass!jbuck Please note that "40a -<ESC>" inserts " -" 40 times, not "-" 80 times. The only way to do that in Emacs (without writing a function) is "^X( -^X)<ESC>40^Xe", 11 keystrokes, and lots of controlling and shifting. And don't forget that the vi command set is orthogonal and object-based. You not only have "d " (same as x) "dw" "dW" "dd", you also can also do "d0" (delete to beginning of line) "d$" (delete to end of line) "d)" (delete to end of sentence (or s-expr in lisp mode)) "d]]" (delete to end of nroff section), and just about anything else you can think of. Even things like "d'a" or "d`a" (delete to mark a) and "d15G" (delete to line 15) and "d/abc<CR>" (delete to the pattern abc) work. (And they can all be repeated....) vi's not Emacs, but it is an amazing editor. I use both, depending on what I am doing. I have even switched between the editors while editing the same file. As has been said before, they're both tools to do whatever it is you want to do. John Owens General Electric Company - Charlottesville, VA jso@edison.GE.COM old arpa: jso%edison.GE.COM@seismo.CSS.GOV +1 804 978 5726 old uucp: {seismo,decuac,houxm,calma}!edison!jso
jbuck@epimass.UUCP (Joe Buck) (10/17/86)
I was going to drop out of the editor wars, but can't let misinformation go uncorrected. In article <690@galbp.UUCP> mjy@galbp.UUCP (Michael Yoffee) writes: > 1. EMACS does NOT have REGULAR EXPRESSIONS which means you > must develop your own pseudo-regular expressions via > macros which is VERY slow(I experimented with this). Both GosEmacs (Unipress) and GNU have regular expressions! What Emacs are you talking about? They're actually a superset of the ones in vi! Next time RTFM before posting. -- - Joe Buck {hplabs,fortune}!oliveb!epimass!jbuck, nsc!csi!epimass!jbuck Entropic Processing, Inc., Cupertino, California
campbell@maynard.UUCP (Larry Campbell) (10/17/86)
In article <690@galbp.UUCP> mjy@galbp.UUCP (Michael Yoffee) writes: > 1. EMACS does NOT have REGULAR EXPRESSIONS which means you > must develop your own pseudo-regular expressions via > macros which is VERY slow(I experimented with this). Sorry to drag this discussion on, but I'm really curious about this. What version of EMACS do you use that doesn't have regular expressions? All three versions I've used (Gosling's, Gnu, and Jove) all have regular expressions. -- Larry Campbell MCI: LCAMPBELL The Boston Software Works, Inc. ARPA: campbell%maynard.uucp@harvard.ARPA 120 Fulton Street, Boston MA 02109 UUCP: {alliant,wjh12}!maynard!campbell (617) 367-6846
casey@monet.Berkeley.EDU (Casey Leedom) (10/17/86)
In article <663@ulowell.UUCP> arosen@ulowell.UUCP (Andy Rosen) writes: >I couldn't live without emacs BUT vi is a lot faster starting up, mainly >with small files (at least on the 4 different UN*Xes I've used). So, >I always use vi when playing with ~/.login, etc. >I always use emacs when doing any kind of software development. Hey, what's wrong with ed? :-) Seriously though, I *actually* use ed for `quickies' ... I find I'm using it more and more often too ... I think maybe I'm getting sick in my old age. :-) A seriously lunatic and hard core Jove user, Casey.
gm@lmi-angel.UUCP@ndmce.uucp (Greg McGary) (10/17/86)
In article <3772@umcp-cs.UUCP>, chris@umcp-cs.UUCP writes: > >In article <113@twg-ap.UUCP> narayan@twg-ap.UUCP (Narayan Mohanram) writes: > >>How about :g/old-string/s//new-string/gc for conditional replace. Or is > >>query replace something different. > > I was ecstatic when I discovered a `confirm' (or `conditional') > suffix to substitute operations in vi. (This was before I ever > saw Emacs.) Then I found that its implementation was rather flawed. > Vi performs the conditional replace by: > > 1. Printing the line. > 2. Printing `^'s below the matched text. > 3. Awaiting confirmation: y<RETURN> or n<RETURN> (others > presumably equivalent to `no'). There are a couple of `best ways' to do conditional substitution that I've found. The first step is to do a simple search for the pattern that you are interested in replacing, using `/' or `?'. Once you have located an instance of your target string, choose the most convenient way to replace it. There are several alternatives: * Following vi's `operator-object' command paradigm, choose an operator that changes text (such as c, C, r, R, s, S) and an object of text (such as w, W, f, t, ), }) and make the appropriate change. * Do a single-line substitution command, leaving the left-hand-side of substitution blank, thereby reusing your original search pattern. (e.g. :s//bletch/) Don't append a `g' for global substitute! Now that you've made the first change, use `n' or `N' to find the next occurrance of your pattern. If you don't want to change this occurance, simply issue another `n' or `N' and proceed to the next occurance. If you do wish to change this one, use vi's `redo' facility to make the identical change with a single keystroke. If you made the first change with a single-line substitution command, repeat the substitution with a `&', if you used an `operator-object' command, repeat it with a `.'. -- -- Greg McGary {decvax!cca,harvard,mit-eddie}!lmi-angel!gm -- ``Make something of yourself! ... Try a casserole!''
wjb@goanna.oz@ndmce.uucp (Warwick Bolam) (10/18/86)
In all this hot-running debate, please allow me to ask a question. Does anyone have any figures on the resources required by vi and emacs? On our system (Vax11/750, 4.2BSD) emacs runs very slowly and consumes lots of cpu. What are other people's impressions (although I'd prefer measurements!)? Warwick Bolam Computing Dept RMIT Melbourne Australia
mjy@galbp.UUCP (Michael Yoffee) (10/22/86)
> What version of EMACS do you use that doesn't have regular expressions?
.......the version I was using was Revision 18.3 EMACS from Prime on a
Prime 9950 under Primos 19.3. Admittedly, this was 2 years ago and more
than likely - Prime has migrated regular expressions to their version of
EMACS by now.
However, I still prefer regular expressions as they are
implemented in VI(1), EX(1), and oh yea, lets not forget an old favorite
called ED(1). By the way, isn't there something to be said for 3 different
editors based on the same command-line edit syntax?
Regards!
Mike
--
Michael Yoffee
Harris / Lanier
Computer R&D
{akgua,akgub,gatech}!galbp!mjy
"These concepts fill a much needed gap..." - [Ken Thompson]
guy@sun.UUCP (10/27/86)
> However, I still prefer regular expressions as they are > implemented in VI(1), EX(1), and oh yea, lets not forget an old favorite > called ED(1). So do I, which is why I'm glad the version of EMACS *I* use has exactly that same kind of regular expression. The claim that "vi" is better than EMACS because "vi" has "ed"-style regular expressions and EMACS doesn't is false; versions of EMACS exist that do have "ed"-style regular expressions. > By the way, isn't there something to be said for 3 different > editors based on the same command-line edit syntax? Like what? -- Guy Harris {ihnp4, decvax, seismo, decwrl, ...}!sun!guy guy@sun.com (or guy@sun.arpa)