I would like to disable the insert key on my keyboard, because I often hit it accidentaly when typing, and it messes up my text.

I found I can use xmodmap to disable insert key completely:

xmodmap -e "keycode 106 ="

This works, but there is another problem. Turns out, midnight commander uses the insert key for entirely different purpose. Not for toggling overtype, as in text editor, but for selecting multiple files.

This feature in mc is actually useful, and I am using it quite often.

Is there any way to disable the insert key in text editors in its role as overtype ON/OFF, but to keep it in its second role as "selecting files" in mc ?

2 Answers 2


Make the Insert key send a different keysym (the symbolic name of the key that determines what key applications think it is), for example F25.

xmodmap -e "keycode 106 = F25"

Configure mc to recognize f25 as a binding for the Mark command: copy /etc/mc.keymap (or wherever the keymap you're using is located) to ~/.mc/mc.keymap and change the line Mark = insert; ctrl-t to Mark = insert; f25; ctrl-t.

  • actually, for some weird reason, it does not work when I use f25. It works when I use f19, but then that does not solve my original problem, because when I accidentally press insert, f19 actually prints ~. I need insert key do do absolutely nothing, unless it is pressed in mc. Sep 22, 2016 at 14:17

Most of Midnight Commander's key-bindings are customizable. The feature you're talking about appears to be Mark, which is in the default keymap file, e.g., /etc/mc.keymap:

Search = ctrl-s; alt-s
Mark = insert; ctrl-t

According to the manual page, if you provide your own keymap file (and make that the first one found), it will use that file instead of the system's keymap. By assigning Mark to a different key-sequence, you can make mc ignore Insert in the case which causes problems.

You can see the other places where Insert is used in mc keymap files by

dpkg -L mc |xargs grep -i -n insert 2>/dev/null

which shows, for example, that it is used in InsertOverwrite.

Binary file /usr/bin/mc matches
/etc/mc/mc.keymap.emacs:81:Mark = insert; ctrl-t
/etc/mc/mc.keymap.emacs:302:InsertFile = f15
/etc/mc/mc.keymap.emacs:304:InsertOverwrite = insert
/etc/mc/mc.keymap.emacs:322:InsertLiteral = ctrl-q
/etc/mc/mc.keymap.emacs:365:Up = k; y; insert; up; ctrl-p
/etc/mc/mc.keymap:80:Mark = insert; ctrl-t
/etc/mc/mc.keymap:220:Store = ctrl-insert
/etc/mc/mc.keymap:221:Paste = shift-insert
/etc/mc/mc.keymap:302:InsertFile = f15
/etc/mc/mc.keymap:304:InsertOverwrite = insert
/etc/mc/mc.keymap:322:InsertLiteral = ctrl-q
/etc/mc/mc.keymap:362:Up = k; y; insert; up; ctrl-p
/etc/mc/mc.keymap.default:80:Mark = insert; ctrl-t
/etc/mc/mc.keymap.default:220:Store = ctrl-insert
/etc/mc/mc.keymap.default:221:Paste = shift-insert
/etc/mc/mc.keymap.default:302:InsertFile = f15
/etc/mc/mc.keymap.default:304:InsertOverwrite = insert
/etc/mc/mc.keymap.default:322:InsertLiteral = ctrl-q
/etc/mc/mc.keymap.default:362:Up = k; y; insert; up; ctrl-p
/etc/mc/mcedit.menu:450:I       Insert `Changelog' string
/etc/mc/mcedit.menu:467:i       Insert a out of command to cursor.
Binary file /usr/bin/mcview matches
Binary file /usr/bin/mcdiff matches
Binary file /usr/bin/mcedit matches
  • thanks, that is helpful. But I don't want to assign Mark to a different key-sequence. I would like to use "insert" key as Mark, while disabling insert (overtype ON/OFF) in other applications May 22, 2016 at 19:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .