Overview
TheVim.unmap() function removes previously defined key mappings created with Vim.map() or Vim.noremap().
Signature
Parameters
The left-hand side: the key sequence to unmap. This should match the
lhs parameter used when creating the mapping.The mode context from which to remove the mapping. Valid values:
"insert"- Remove mapping from insert mode"normal"- Remove mapping from normal mode (default)"visual"- Remove mapping from visual mode
Return Value
This function does not return a value.
Examples
Unmap in Insert Mode
Remove thejj to <Esc> mapping:
Unmap in Normal Mode
Remove a normal mode mapping:Conditional Unmapping
Unmap based on user preference:Notes
- Unmapping a non-existent mapping has no effect and does not throw an error
- The
contextparameter must match the context used when creating the mapping - You cannot unmap built-in Vim keybindings, only user-defined mappings
- Key mappings are global and affect all editor instances
See Also
- Vim.map() - Create key mappings
- Vim.mapclear() - Remove all mappings for a context

