Backspace and Arrow Keys Aren't Working in Irb(Git Bash Console) on Windows MAChine

Backspace and arrow keys aren't working in IRB(Git Bash console) on windows machine

Same thing happened to me. Running irb with --noreadline solved my problem:

irb --noreadline

Tab completion and arrow keys don't work in GHCI in Git Bash

Not having received any responses here, I cross-posted the question to the project's GitHub repository.

Apparently, this issue seems to be related to the mintty terminal emulator. If you instead install Git Bash with the ConHost emulator, the problem goes away.

backspace does not work git bash

I had this same problem today after switching to mintty with a fresh version of git. In my case, it was an old .bashrc file I'd been carrying around for many years with the line export TERM=ansi. After removing that and starting a new bash, everything works again.

More generally, to debug, I was suspicious of all the dot-config stuff in my home directory--so I moved things like .bash_profile, .bashrc, .inputrc, etc. into a temporary directory where they wouldn't be read by bash. Then, I started bash and saw that it worked. I mention it because, if it isn't specifically the TERM issue I had, you might be able to debug using the same technique.

Why does hitting the left arrow in irb give me ^[[D ?

You need to do:

sudo apt-get install libreadline-dev

and then reinstall ruby and irb.

How to format irb command prompt

The irb man page has a section on "Customizing prompt". Here's mine for example:

IRB.conf[:PROMPT][:CUSTOM] = {
:PROMPT_I => ">> ",
:PROMPT_S => "%l>> ",
:PROMPT_C => ".. ",
:PROMPT_N => ".. ",
:RETURN => "=> %s\n"
}
IRB.conf[:PROMPT_MODE] = :CUSTOM
IRB.conf[:AUTO_INDENT] = true

To use this, add it to your ~/.irbrc file (creating it if it doesn't exist.)



Related Topics



Leave a reply



Submit