Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!mips!sgi!shinobu!odin!gold From: gold@sgi.com (Michael Gold) Newsgroups: comp.sys.sgi Subject: Re: Alternatives to /usr/sbin/bindkey for window pop/push ? Keywords: key bindings bindkey tcsh vi alternatives Message-ID: <1991Jan14.220634.4021@odin.corp.sgi.com> Date: 14 Jan 91 22:06:34 GMT References: <1991Jan8.015407.22178@bhpmrl.oz.au> Sender: news@odin.corp.sgi.com (Net News) Organization: Silicon Graphics, Inc., Mountain View, CA Lines: 44 In article <1991Jan8.015407.22178@bhpmrl.oz.au> tim@bhpmrl.oz.au (Tim Monks) writes: > >I have been using /usr/sbin/bindkey and the following key-bindings for a >while : > > /usr/sbin/bindkey -l f1,push > /usr/sbin/bindkey -l f2,pop > >If I try any command in vi which requires variable expansion, then I get >an error message. For example, under csh the following command in vi : > > :r $tlib/abort.c > >works quite happily and reads in the file /ipada/tim/tomography/abort.c >but under tcsh I get the following message : > > "^[P103;146.ypush^[\^[P103;147.ypop^[\/ipada/tim/tomography/lib/abort" > No such file or directory > >The problem is caused by /usr/sbin/bindkey, since if I remove the two lines >from my .cshrc which bind F1/F2 to window pop/push, vi under tcsh does >variable expansion quite happily. > The problem is in your .cshrc . When vi forks a tcsh to expand the variable, the tcsh runs your .cshrc, which runs bindkey, which sends a control string to stdout. To fix this, you need to conditionalize your .cshrc: if ($?prompt) then /usr/sbin/bindkey -l f1,push /usr/sbin/bindkey -l f2,pop endif This way, bindkey is only run if you start up a tcsh (or csh) for normal, interactive use. Note that if you set your prompt in your .cshrc it should be done after the `if' (and preferably inside it!). Most of my .cshrc sits inside the `if' statement: all but my PATH definition and commands to protect me from myself (such as "alias rm \rm -i"). -- Michael I. Gold You go your way, I'll go mine, Silicon Graphics Inc. I don't care if we get there on time, Internet: gold@sgi.com Everybody's searching for something they say, Voice: (415) 335-1709 I'll get my kicks on the way...