How to get the Home & End keys working in Cygwin (RXVT)

Last year I blogged about how to get the Home & End keys working in remote Linux shells & terminals. Well now it's time to sort the Windows shell Cygwin out.

If your Home and End keys are producing funny characters on the command line rather than moving the cursor then the input codes of the keyboard need to be remapped.

Open your Cygwin terminal and create a file called .inputrc in your home directory, and add the following:

# Home Key
"\e[7~":beginning-of-line

# End Key
"\e[8~":end-of-line

# Delete Key
"\e[3~":delete-char

# Insert Key
"\e[2~":paste-from-clipboard
Now edit or create .bashrc in your home directory and add the following line to ensure the above .inputrc file is picked up:
export INPUTRC=$HOME/.inputrc
To see if all the above has worked, reopen your cygwin terminal and try it out! If it doesn't work then just delete the .inputrc file and remove the line from .bashrc.

Technorati Tags: , , , , , , ,

1 comment:

Erik Henrique said...

Hello, Thank you for this!