This is an old revision of the document!


mapping keys

  • for help see ':help mapping' in vim
  • typical syntax:
    :mappingcommand [special arguments] {lhs} {rhs}
    
    example:
    " this sets F3 to toggle line wrapping
    :map <F3> :set wrap!<CR>
  • [type]noremap is often used to redefine a command to avoid nested and recursive mappings
  • there are five sets of mappings:
    :map  (Normal, Visual+Select, Operator-Pending)
    :nmap (Normal, when vim is waiting for any key to be a command)
    :vmap (Visual, when a visual selection has begun)
    :omap (Operator-pending mode, after "d", "y", "c", etc...)
    :imap (Insert mode, when you are typing characters)
    :cmap (Command-line mode, when entering a ":" or "/" command)
  • to remove a key mapping:
    unmap
    nunmap
    vunmap
    ounmap
    iunmap
    cunmap
  • on the Mac, the command key is mapped as <D- >
  • to view a list of current mappings:
    :map
  • to view a list of current mappings and the last place each item was set from:
    :set verbose=1
    :map
  • on the Mac the pasteboard (clipboard) is at register “*
  • docs/vim/mapping_keys.1246426719.txt.gz
  • Last modified: 2009/06/30 23:38
  • by billh