Autocommands are a way to automatically execute code when certain events happen.
Execute commands automatically on events.
If the -javascript (short name -js) option is specified, cmd is executed as JavaScript code, with any supplied arguments available as variables.
Add cmd to the list of commands &liberator.appname; will execute on event for a URL matching pat:
Available events:
pat is a regular expression, use .* if you want to match all URLs.
The following keywords are available where relevant:
Apply the autocommands matching the specified URL to all buffers. If no
Apply the autocommands matching the specified URL to the current buffer. If no
Enable passthrough mode on all Google sites:
:autocmd LocationChange .* js modes.passAllKeys = /google\.com/.test(buffer.URL)
Enable passthrough mode on some Google sites:
:autocmd LocationChange .* js modes.passAllKeys = /(www|mail)\.google\.com/.test(buffer.URL)
Set the filetype to mail when editing email at Gmail:
:autocmd LocationChange .* :set editor=gvim -f
:autocmd LocationChange mail\\.google\\.com :set editor=gvim -f -c 'set ft=mail'