Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
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

2 Answers 2

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.

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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