[comp.unix.questions] Comments in .exrc?

RSS%CALSTATE.bitnet@vm.usc.edu (Richard S. Smith) (05/03/91)

Here's an interesting one:  I'm looking for a way to selectively
comment out certain lines in my .exrc file.  The problem is that
vi leaves precious few keys left for remapping, so I need the
ability to turn the definitions on and off with as little fuss
as possible.

If I try a # at the beginning of a line, I get some error message,
and the whole rest of the file gets bypassed.  I could exploit this
as a feature, but I really don't want to.

I suppose the underlying question is whether ex has a "comment" or
"no-op" command.  There's none mentioned in my (Xenix) manuals.

Any ideas?

Richard Smith - RSS@CALSTATE.BITNET

tchrist@convex.COM (Tom Christiansen) (05/03/91)

Start lines with " to comment them, as in:

"
"       INPUT MACROS that i always want active
"
map! ^Z ^[:stop^M
"       so i can stop in input mode.  note that autowrite is set, so
map! ^A ^[:stop!^M
"       will stop me without writing.
map! ^K ^V^[O
"       lets me do kindof a negative carriage return in input mode.


--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
		"So much mail, so little time." 

boykin@encore.com (Joseph Boykin) (05/03/91)

In article <26748@adm.brl.mil>, RSS%CALSTATE.bitnet@vm.usc.edu (Richard S. Smith) writes:
|> Here's an interesting one:  I'm looking for a way to selectively
|> comment out certain lines in my .exrc file.  The problem is that
|> vi leaves precious few keys left for remapping, so I need the
|> ability to turn the definitions on and off with as little fuss
|> as possible.
|> 
|> If I try a # at the beginning of a line, I get some error message,
|> and the whole rest of the file gets bypassed.  I could exploit this
|> as a feature, but I really don't want to.
|> 
|> I suppose the underlying question is whether ex has a "comment" or
|> "no-op" command.  There's none mentioned in my (Xenix) manuals.


Fortunately, it's not as "interesting" a problem as you think.
Vi/Ex use the double quote as a comment character.  All characters
to the end of the line are ignored.  For example:

	set ic sm ai
	" comment
	set wm=0 report=1


----

Joseph Boykin
Manager, Mach OS Development
Encore Computer Corp
Treasurer, IEEE Computer Society

Internet: boykin@encore.com
Phone: 508-460-0500 x2720

rouben@math9.math.umbc.edu (Rouben Rostamian) (05/03/91)

In article <26748@adm.brl.mil> RSS%CALSTATE.bitnet@vm.usc.edu (Richard S. Smith) writes:
>I suppose the underlying question is whether ex has a "comment" or
>"no-op" command.  There's none mentioned in my (Xenix) manuals.

The "comment" symbol is a double-quote sign in the beginning
of the line, as in:

" This text will be skipped
" This too.

--
Rouben Rostamian                          Telephone: (301) 455-2458
Department of Mathematics and Statistics  e-mail:
University of Maryland Baltimore County   bitnet: rostamian@umbc.bitnet
Baltimore, MD 21228,  U.S.A.              internet: rouben@math9.math.umbc.edu

crr@cbnewsm.att.com (Chris Riley (201) 564-2516) (05/03/91)

In article <26748@adm.brl.mil> RSS%CALSTATE.bitnet@vm.usc.edu (Richard S. Smith) writes:
>I suppose the underlying question is whether ex has a "comment" or
>"no-op" command.  There's none mentioned in my (Xenix) manuals.
 
>Richard Smith - RSS@CALSTATE.BITNET

Vi/ex will ignore lines in the .exrc file that start with the double quote
character (").  You can't have blank lines though.
-- 
Chris Riley            chris.riley@attbl.att.com

rhartman@thestepchild.sgi.com (Robert Hartman) (05/03/91)

In article <26748@adm.brl.mil> RSS%CALSTATE.bitnet@vm.usc.edu (Richard S. Smith) writes:
>Here's an interesting one:  I'm looking for a way to selectively
>comment out certain lines in my .exrc file.  ...
>
>Richard Smith - RSS@CALSTATE.BITNET

It isn't documented, but in some versions of ex the double-quote in the
leftmost column is, I believe, taken as a comment.

-r