O'Reilly logo

Mastering Vim by Ruslan Osipov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Mode – aware remapping

The :map and :noremap commands work for normal, visual, select, and operator pending modes. Vim supports a more fine-grained control over which modes the mappings work in:

  • :nmap and :nnoremap: Normal mode
  • :vmap and :vnoremap: Visual and select modes
  • :xmap and :xnoremap: Visual mode
  • :smap and :snoremap: Select mode
  • :omap and :onoremap: Operator-pending mode
  • :map! and :noremap!: Insert and command-line modes
  • :imap and :inoremap: Insert mode
  • :cmap and :cnoremap: Command-line mode
Vim often uses an exclamation mark ! to force command execution, or to add additional functionality to a command. Try :help! for yourself!

For example, if you wanted to add some mappings to alter some insert mode behavior, you could do this: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required