docs:vim:mapping_keys

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 “*
  • if you are using gvim in windows, and you lose your ability to cut/copy/paste with Control-X,C, and V, you probably had the carriage returns removed from your vimrc file
    • rename your .vimrc file temporarily
    • start up gvim and type :mkvimrc ~/.vimrc-default
    • compare the listings in this file with your vimrc file and fix as necessary
  • docs/vim/mapping_keys.txt
  • Last modified: 2009/07/01 00:13
  • by billh