Is there a way to enable Ctrl + ← / → keyboard shortcuts (go to previous / next word) in the Bash console installed with MSysGit?
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
Not really answering your question, but you can try ALT-F and ALT-B instead.
Adding to my ~/.inputrc
"\e[1;5C": forward-word
"\e[1;5D": backward-word
Was enough for me.
This worked for me in Windows 7:
Add this to the ~/.inputrc
Then restart the console and it should work for you.
This makes it so you can do either use
CTRL+← or CTRL+→
Or
ALT+← or ALT+→
## Windows msysgit
## Alt + right/left
"\e\e[C": forward-word ### Alt + right
"\e\e[D": backward-word ### Alt + left
## Ctrl + right/left
"\e[C": forward-word ### Ctrl + right
"\e[D": backward-word ### Ctrl + left
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With