I'm using csh via PuTTY from a Windows PC and since I'm used to having the HOME button just place the cursor at the beginning of the string (instead of inserting ~) or ctrl+arrow place the cursor at the start/end of another word, I'd like to have that kind of navigation in the shell. What are the options for doing that?
I guess PuTTY just passes my commands to the shell and to do that kind of things I'd have to change its properties, but perhaps I could just tell PuTTY to substitute stuff for me or maybe use another client?
Thanks.

link|improve this question

60% accept rate
2  
Are you using bash or csh? They are two different shells. – AndrejaKo Feb 24 '11 at 12:30
@AndrejaKo, in this situation csh, but it's not that I don't want that behavior in other shells I use – Fluffy Feb 24 '11 at 13:20
feedback

2 Answers

I don't think there's much you can do about csh other than run it using rlwrap.

However, for tcsh and Bash, it's easy.

Here's an example for tcsh:

bindkey ^[OC forward-word

and for Bash:

bind '"\eOC": forward-word'

If you put this line in your ~/.inputrc it will affect Bash, rlwrap and other readline-based programs:

"\eOC": forward-word

The character sequence you use will depend on what the terminal is emitting. Press Ctrl-v then the key you're interested in, Ctrl-Right Arrow for example, and it will show you the sequence the key outputs. You'll see something like:

^[OC

which represents Escape-O-C. The Ctrl-[ is output as one character representing Escape, but you would type a carat then a left square bracket or a backslash and an "e".

You can list the bindings in tcsh using bindkey or in Bash using `bind -p.

link|improve this answer
feedback

In PuTTY, have a look at the Keyboard options under the Terminal options. I know you can fix the Home/End characters in they keyboard options, however I don't think there is anything you can do from PuTTY to get the Ctrl+Arrow to work, that would probably have to be a feature of your shell.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.