[comp.editors] Does vi have a conditional

ray@vantage.UUCP (Ray Liere) (04/27/91)

Is there an "if" statement in vi?

I would like to put statements into my .exrc that are conditional
(based on $TERM) and would like to do this directly in .exrc (versus
having the .profile set up EXINIT for me based on $TERM).

For example (pseudocode),
	if $TERM is vt102
	then
		map ..
		set ..
		other .exrc-like things ...
	fi

Thanks!

Ray Liere
Vantage Consulting and Research Corporation
voice: +1 503 657 7294
uucp: uunet!nwnexus.WA.COM!vantage!ray
       -or-
      hplabs!hpubvwa!hpupora!vantage!ray
Internet: ray%vantage@nwnexus.WA.COM

steinbac@hpl-opus.hpl.hp.com (Guenter Steinbach) (05/01/91)

In comp.editors, ray@vantage.UUCP (Ray Liere) writes:

> Is there an "if" statement in vi?

I believe not, unfortunately.

The only semblance of a conditional action is the fact that a mapped
command that consists of several subcommands stops working altogether
on the first failed subcommand.  And that mapped command could itself
map other commands if successful.

This can come in handy but I doubt that it is powerful enough for your
purposes.

	 Guenter Steinbach		gunter_steinbach@hplabs.hp.com

ed@lvw6.lvw.loral.com (Ed Allen) (05/02/91)

In article <1370010@vantage.UUCP> ray@vantage.UUCP (Ray Liere) writes:

   Path: wdl1.wdl.loral.com!mips!zaphod.mps.ohio-state.edu!caen!dali.cs.montana.edu!milton!sumax!nwnexus!vantage!ray
   From: ray@vantage.UUCP (Ray Liere)
   Newsgroups: comp.editors
   Date: 26 Apr 91 17:13:50 GMT
   Organization: Vantage Consulting and Research Corporation
   Lines: 23

   Is there an "if" statement in vi?

   I would like to put statements into my .exrc that are conditional
   (based on $TERM) and would like to do this directly in .exrc (versus
   having the .profile set up EXINIT for me based on $TERM).

How about ?

so $TERM

Seems to work on SUNs and HPs.

   Thanks!


Your welcome.  It's a pleasure.
--
Never trust a man who wears white shoes.           | Ed Allen
Vote Libertarian...     Scare the Hell out of 'em. | Loral Command & Contr. Sys.

ken@hertz.njit.edu (ken ng cccc) (05/02/91)

In article <ED.91May1195659@lvw6.lvw.loral.com> ed@lvw6.lvw.loral.com (Ed Allen) writes:
:In article <1370010@vantage.UUCP> ray@vantage.UUCP (Ray Liere) writes:
:   Is there an "if" statement in vi?
:   I would like to put statements into my .exrc that are conditional
:   (based on $TERM) and would like to do this directly in .exrc (versus
:   having the .profile set up EXINIT for me based on $TERM).
:so $TERM

While that would solve the individual problem, I'd really love to have
a REAL if statement in vi.  There have been many times I've wanted to
write a vi function like one can with REXX/XEDIT, to draw on the capabilities
of vi, but it just isn't there the best I can tell.

Kenneth Ng
"No problem, this is how you make it" -- R. Barclay, ST: TNG