neovim/neovim — pull request #1218 by fmoralesc (2014-09-22 18:44:11+00:00)
Title: [WIP] Add CmdPre autocommand.

Triggers before commands are executed. The pattern is matched against the command. Can be used to ensure some condition is met before the command is executed.

Inspired by the discussion on issue #1190. This event can be used to do this:

~~~ vim
function! python_setup()
if !exists('loaded_python_setup') || g:loaded_python_setup != 1
" initialize the python host
...
let g:loaded_python_setup = 1
endif
endfunction

au! CmdPre python call python_setup()
~~~

## TODO

[ ] Add tests.
[ ] Idea: Allow the pattern to match a glob, like `py*`.