Autocommands are a way to automatically execute code when certain events happen.
Execute commands automatically on events.
When
When
Available
For Ex
Apply all event autocommands matching the
specified
Apply all autocommands matching the specified
Enable passthrough mode on all Google sites:
:autocmd LocationChange google\.com -js modes.set(modes.PASS_THROUGH)
Enable passthrough mode on some Google sites:
:autocmd LocationChange (www|mail)\.google\.com -js modes.set(modes.PASS_THROUGH)
Set the filetype to mail when editing email at Gmail:
:autocmd LocationChange !mail\.google\.com gvim -f
:autocmd LocationChange mail\.google\.com gvim -f -c 'set ft=mail'