I have a keyboard with an undo key right next to the esc key. I often miss esc, hit undo, which causes the vim process to be stopped. How can I remap the undo key in vim such that it doesn't do anything? I know how to map keys in vim, but I can't make it work for this particular key.


1 Answer 1


You can get the character(s) that this key sends by using <C-v>[key] in commandline or insert mode; for example <C-v><F1>.

This will probably be multiple characters starting with the escape character (^[). You can then map this to <Nop>:

nnoremap <Esc>OP OP <Nop>

This example is F1 on my system.

Replace ^[ with <Esc>; you can also use the literal escape character, but that can be a bit awkward to edit.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.