rrw@ccice2.UUCP (Rick Wessman) (12/16/84)
In our 4.2, "vi" seems to look for a local .exrc file before using my home directory's. Has anybody else noticed this? Rick Wessman ...!seismo!rochester!ccice2!ccice5!rrw
ddaly%xls-plexus01.amc@amc-hq.arpa (DUSTY) (02/26/85)
This may sound like a dumb question but, several people have asked me if vi is public domain. Not wanting to ASSUME I knew the correct answer I decided to pose the question to the net. The questioners are in a Sys V environment(I thought vi was included with Sys V) Thanks for your responses. You can answer directly to me at <ddaly at amc-hq>. Also, please add the following address to the info.unix recipients <grizzo at amc-hq> Ed Daly AMCLSSA Chambersburg, PA
sasaki@harvard.ARPA (Marty Sasaki) (02/26/85)
This topic got beaten to death a while ago (at least in net.unix). The answer is no, it is not in the public domain. Parts of vi (and ex) are based on ed, so at least part of the code belongs to AT&T. The rest of vi belongs to the regents of UCB. Marty Sasaki sasaki@harvard.{arpa,uucp}
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
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!''