Search code examples
vimkeyboard-shortcuts

How can I remap the command ":u" (UNDO) in Vim?


Is there a way to remap the command :u with CTRL+z?


Solution

  • u is already a normal-mode command to undo the last change. You can remap Control-Z to undo with

    nnoremap <C-z> u
    

    (assuming, of course, that Control-z isn't already being used by your terminal as to send SIGSTOP to the foreground process).