MSysGit Bash - how to enable Ctrl+Left / Right arrows?
At your Bash prompt, press Ctrl-v Ctrl-Left-Arrow and Ctrl-v Ctrl-Right-Arrow and make note of the output. You should see something like: ^[OD
and ^[OC
or similar. Add the following lines to your ~/.inputrc
:
"\eOC": forward-word"\eOD": backward-word
where you will substitute \e
for escape (^[
) and the rest of the characters you got (OD
, OC
or similar).
To re-read the file and make the changes active immediately, press Ctrl-x Ctrl-r.
I found this answer by tan on AskUbuntu, which worked for me after none of these answers did. I'll repost it here.
What is in your ~/.inputrc
and /etc/inputrc
? The minimum to get those keys working is, I think:
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving"\e[1;5C": forward-word"\e[1;5D": backward-word"\e[5C": forward-word"\e[5D": backward-word"\e\e[C": forward-word"\e\e[D": backward-word
If you have these in /etc/inputrc
, the file needs to be included from ~/.inputrc
, so check that it has the following line:
$include /etc/inputrc