Instead, trigger an auto command whenever a .snippets file is saved that will reload the snippets. This is a performance improvement with a loss of functionality: externally (i.e. outside of the current Vim instance) generated snippet files will not be picked up until UltiSnips#RefreshSnippets is called.
I decided to not expose a command for this, since I assume it is rarely useful. I think the command would add confusion of when it was supposed to be ran.
Fixes#932.
* Improve/simplify filetype handling for buffers
There is no need to have a FileType autocmd anymore, which for some odd
reason even had to be in "ftdetect"?!
Now it will just use the `&filetype` property from buffers, instead of
updating it on FileType events.
This allows for easier lazy-loading of UltiSnips; without this patch it
would not have updated the list of filetypes for the buffer after just
being triggered (e.g. through NeoBundle's lazy-loading).
I am using the following currently:
NeoBundleLazy 'SirVer/ultisnips', {
\ 'on_funcs': ['UltiSnips#ExpandSnippetOrJump']}
inoremap <silent> <c-j> <C-R>=UltiSnips#ExpandSnippetOrJump()<cr>
By manually defining the mapping for the trigger, I can invoke it and
NeoBundle will trigger the loading of the plugin.
The python module is now pulled in autoload/UltiSnips.vim. This means
that parsing of the .vimrc will only map the keys and set some options -
very cheap.
Unfortunately, the autocommands set up in plugin/UltiSnips.vim pulls in
the python code basically immediately still.
Without this, UltiSnips will throw a lot of errors in case it's not
available.
This does not look at `g:UltiSnipsNoPythonWarning`, because it is not
auto-detected, but provided by the user's config.
When bootstrapping fails to setup `g:_uspy` (e.g. without Python),
the functions used in the autocommands are not being defined.
Since it makes no sense to have autocommands defined for UltiSnips in this
case, this patch deletes them (via a new augroup 'UltiSnips').