Autocommands are a way to automatically execute code when certain events happen.
Execute commands automatically on events.
When
When
If the -group=group flag is given, add this
autocommand to the named
Available
For Ex
Apply all event autocommands matching the
specified
Apply all autocommands matching the specified
Enable Pass Through mode on all Google sites:
:autocmd LocationChange google.com :normal!
Enable Pass Through mode on some Google sites:
:autocmd LocationChange www.google.com ,mail.google.com :normal!
or
:autocmd LocationChange ^https?://(www|mail)\.google\.com/ :normal!
Set the filetype to mail when editing email at Gmail:
:autocmd LocationChange !mail.google.com ,*
:autocmd LocationChange mail.google.com gvim -f -c 'set ft=mail' +<line>