Red Hat Bugzilla – Bug 6223
Can't backspace in vim in console mode
Last modified: 2008-05-01 11:37:52 EDT
I can't backspace in vim in console mode (i.e. non-X mode).
When I type backspace I get ^? displayed. This problem
occurs for both vim-enhanced-5.3-7 and vim-enhanced-5.4.2.
Interestingly, I don't have this problem inside KDE either
running vim or gvim.
I think this is because:
The termcap and terminfo databases disagree on how to delete to the
left on the linux console. Termcap says
# * Some Linuxes come with a default keyboard mapping that makes
kbs=^? and *
# * all have kcbt=^I. Apply `loadkeys -d' to change this if
necessary, and *
# * bug your Linux distributor to get it right in the next release.
# * are the keymap replacement lines that will fix the
# keycode 14 = BackSpace BackSpace
# alt keycode 14 = Meta_BackSpace
# keycode 15 = Tab Tab
# alt keycode 15 = Meta_Tab
# shift keycode 15 = F26
# string F26 ="\033[Z"
and kb=^H and kD=\E[3~ This is termcap-9.12.6-15
terminfo has kbs=\177 and kdch1=\E[3~
I have a patch that fixes the console keymaps to give BackSpace (^H)
with the unshifted backspace key and Delete (^?) with the Control key
for all languages. No need to change Russian, they were already set
up that way. This would match the termcap entry.
Alternatively, the termcap entry could be changed to match the
terminfo entry (^?). The disadvantage of this is that xterm has a
strong tendency to produce ^? for the Delete keysym (bottom left on
the six-key block above the cursor keys). You would want that (^?) to
delete the letter under the cursor in readline apps like bash. You
can achieve that by adding
to /etc/inputrc, but then things will go wrong in the console.
Therefore I favour fixing things so ^H is used on the console. This
has the added advantage that on the console the backspace and delete
keys are mapped in such a way that XFree automatically gives them the
correct BackSpace and Delete keysyms when it reads the console
keyboard and sets up the default keymap. That way Motif apps just
I have a fix to mingetty to get it to issue the required stty so
things work on the console.
The present situation with backspace and delete is not very
satisfactory. On a standard install, under the console and xterm,
none of the readline apps, including bash, are capable of deleting the
character under the cursor when the user presses the Delete key. They
either don't work, or delete in the wrong direction.
This is related to bug 6358
fixed for 6.2 and later.
What RPM(s) do I need to install to fix this bug for RH 6.0?