gitbashbackspacerxvt

Windows version of rxvt Backspace key doesn't work as expected


I'm using rxvt.exe, the alternative to bash.exe that comes with msysgit. My OS is WinXP.

I invoke the console with "C:\Program Files\Git\bin\rxvt.exe" -e /usr/bin/bash --login -i

The backspace key deletes everything backward to the beginning of the line, rather than just one char back.

I've experimented using things like

'bind "C-e":backward-delete-char' just to see if I can bind the behavior to a ctrl sequence, and that works, but I can't figure out how to bind with the backspace key.  I've tried binding to e\14 and e\08, but they don't work.

An extensive google search turned up plenty of Linux solutions but very little for rxvt on Windows, and nothing that addressed this problem.

Thanks a million to anyone who can provide an answer!

-Jill


Solution

  • Do I have the solution for you! Thanks for bringing this up, I've known it was a problem, but never knew how to fix it. Here you go:

    1. Start a git bash shell
    2. cd ~ (your home directory)
    3. Create a new file called .inputrc and fill it with the following:

      "\e[3~": delete-char
      # this is actually equivalent to "\C-?": delete-char
      # VT
      "\e[1~": beginning-of-line
      "\e[4~": end-of-line
      # kvt
      "\e[H":beginning-of-line
      "\e[F":end-of-line
      # rxvt and konsole (i.e. the KDE-app...)
      "\e[7~":beginning-of-line
      "\e[8~":end-of-line
      
    4. Save the file and exit, you should be able to restart with your original command, "C:\Program Files\Git\bin\rxvt.exe" -e /usr/bin/bash --login -i and use the backspace!

    Inspiration for this solution is found here.

    Thanks!