Google Answers Logo
View Question
 
Q: Using home key in tcsh ( Answered 4 out of 5 stars,   1 Comment )
Question  
Subject: Using home key in tcsh
Category: Computers
Asked by: jalanb-ga
List Price: $15.00
Posted: 14 Jun 2002 19:18 PDT
Expires: 21 Jun 2002 19:18 PDT
Question ID: 27006
How do I use the Home Key to move to the start of the command line ?

I use a Dell Inspiron PC, which is connected via Hummingbird's Exceed
to a Solaris server. I log in through an xterm window running tcsh as
my shell.

I want to use <Home> and <End> as "goto start of line" and "goto end
of line" respectively on the command line. While we're on the subject
it's be nice to find out how to set up the F1, F2, F3 ... keys for
specific operations too.

And how do I get it all to work from the PC ? So that I don't have to
make changes on every server I log in to ?
Answer  
Subject: Re: Using home key in tcsh
Answered By: webadept-ga on 14 Jun 2002 23:51 PDT
Rated:4 out of 5 stars
 
Hi, 

First make a backup copy of your ~/.cshrc file. like this :
  cp .cshrc cshrc.back

Using Vi (or whatever editor you have available) Put the following
lines in your personal ~/.cshrc file:

#.cshrc
 if ($term == "xterm" || $term == "vt100" \
            || $term == "vt102" || $term !~ "con*") then
          # bind keypad keys for console, vt100, vt102, xterm
          bindkey "\e[1~" beginning-of-line  # Home
          bindkey "\e[7~" beginning-of-line  # Home rxvt
          bindkey "\e[2~" overwrite-mode     # Ins
          bindkey "\e[3~" delete-char        # Delete
          bindkey "\e[4~" end-of-line        # End
          bindkey "\e[8~" end-of-line        # End rxvt
      endif

This should give your keys the right mapping, or at least the mapping
you are looking for.

You can bind keys, such as the F1 key to anything you like. I
recommend getting a book on tcsh, to see what else is available for
mapping commands. The nice thing is most servers are setup so that you
can change your personal settings without affecting anyone else.

You won't have to make changes every time you log in. Once the changes
are made to the resource file, they are made. That's it. You can edit
the resource file anytime you like, and then those changes are
complete. Nothing needs to be done on your PC.

A tip at this point : I would suggest strongly getting a hold of your
System Admin and asking him to help you with these changes. He may
know a better way, or be able to guide you through the process. If you
are not fimiler with editing resource files, I strongly suggest you do
this.

Thanks for the question, and be sure to make the backup copy before
you get started.

webadept-ga

Request for Answer Clarification by jalanb-ga on 15 Jun 2002 16:17 PDT
I specifically asked for a solution to work on the PC, not on the
server - I commonly log in to *many* servers, and do not want to have
to change my .cshrc on every one of them.

I am looking for something to work with Exceed, not at shell level.

Furthermore - your suggested solution does not work.

Clarification of Answer by webadept-ga on 16 Jun 2002 01:13 PDT
Sorry that didn't work for you and I apologize for the confusion of
the Windows change, vs.. the server change. Not really sure what I was
thinking there, you plainly stated the request. Again I appologize.

The following instructions should bring you to the keyboard
configuration utility for Exceed on your computer.

double-click on the Xconfig icon

which will produce a further window of icons.
Select your primary keyboard
click on Mapping in the Edit pull-down menu of the Xkeys window and

Map the keys you would like using this utility. 


This is a company help file which will lead you in the right direction
http://www.keele.ac.uk/depts/cc/helpdesk/xwin/config_Ex6.html


Some support documents that may be of interest to you from Hummingbird

Key binding Error -- Hummingbird website Support Section
http://www.hummingbird.com/support/nc/exceed/ex60299.html

Mouse wheel support in Exceed
http://www.hummingbird.com/support/nc/exceed/ex60290.html


If this doesn't work for you please let me know and I'll hunt down
further information for you.

Thanks 

webadept-ga
jalanb-ga rated this answer:4 out of 5 stars
That's enough for me - in particular the page from Keele proved very
helpful in not only my "Home" problem, but general setup of my Exceed
config.

Thanks

Comments  
Subject: Re: Using home key in tcsh
From: 1e100ga-ga on 16 Jun 2002 13:39 PDT
 
tcsh will not read the .cshrc file if you have a .tcshrc file.  In
that case the commands need to go in the .tcshrc file.  You should be
able to make the home key go to the start of the line on the server
level by typing:

bindkey ctrl-v<press your home key> beginning-of-line

Note that when you press ctrl-v nothing should display on your screen,
it just tells the server to insert the next character literally
instead of trying to interpret it.  The command line should look
something like

bindkey ^[[1~ beginning-of-line

You can do the same thing to map the end key to end-of-line

In order to get this to work from your PC, you need to first find out
how those functions are mapped on the server.  Typically
beginning-of-line is mapped to "^A" which means ctrl-A, and
end-of-line is mapped to "^E" which means ctrl-E.  You can verify this
by typing 'bindkey' by itself or 'bindkey |grep beginning' and looking
for the appropriate line.

Then you can go to the Exceed input editor and set the home key to
ctrl-A and so on.  You may be able to do this as a key mapping, but to
me it looks like this will need to be done as a macro.  To set it up
as a macro, go into the Xconfig window and then Input.  Click on
Edit/Macros.../Add.../Start Record, and press ctrl-A.  It will
probably be displayed as "+[ctrl][a]-[ctrl]".  Click on Stop Record,
and then select the Home key in the bind list (hopefully it is in
there), and click OK.  Save the keyboard file by going to File/Save
As.  There is an example of this at
http://wwwinfo.cern.ch/ce/ae/Saber/exceed/exceed.html

For more information on bindkey you can go to
http://www.rt.com/man/tcsh.1.html or type 'man tcsh' on the server,
and look for the bindkey section.

You can also download a keyboard definition file designed for solaris
at ftp://ftp.hcl.com/pub/bbs/fontkbd/sunkbf.zip

The instructions for installing it are at
http://www.hummingbird.com/exceedusers/Jul2001/0044.html

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy