In the default Cygwin installation, using CTRL-LEFTARROW or CTRL-RIGHTARROW simply prints 5C or 5D instead of skipping a word at a time as expected.
Home/End keys work properly, so remapping should be possible.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityFound a solution, posting it here for posterity.
Add the following lines to ~/.inputrc
(C:\cygwin\home\<username>\.inputrc
):
"\e[1;5C": forward-word # ctrl + right
"\e[1;5D": backward-word # ctrl + left
When done you can press C-x C-r
to re-read the .inputrc
file for the current session.
Things to note if you want other similar customisations: Use 5A
and 5B
for up and down arrows, and 2x
for shifted versions.
The "official" key mappings are described in the Bash Reference Manual, but for a quick way to find a key mapping, in bash:
^[[1;3C
^[
and replace it with \e
to make \e[1;3C
.inputrc
file.In case you want something that'll work without custom environment settings, for instance when working on a shared account on a server or just to limit the amount of custom configuration being used, Bash has built-ins for this that work in Cygwin.
Namely Alt+f to move forward and Alt+b to move backward.
http://www.gnu.org/software/bash/manual/html_node/Commands-For-Moving.html
When using rxvt with cygwin I found the solution at this link worked for me: control_arrow_keys_in_rxvt.
Add the following lines to ~/.inputrc
:
"\eOd": backward-word
"\eOc": forward-word
This solution also works in msys2
consoles:
"\e[1;5C": forward-word # ctrl + right
"\e[1;5D": backward-word # ctrl + left
Just place these key combinations in the .inputrc
file.
~/.inputrc
file - which annulled all the linux mint defaults. You can get them back by adding$include /etc/inputrc
to the top of your ~/.inputrc (assuming that /etc/inputrc is your system-wide inputrc, which it is on Linux Mint)