New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lazy loading Ultisnips and custom snippets #280
Comments
Lazy Loading is not supported by Vim in any way, i.e. it is a hack by your plugin manager. UltiSnips needs to know the runtimepath of snippets it should load, which is conflicting with lazy loading obviously. So no, there is no support from UltiSnips for this. |
I think you must initialization your custom snippet directory before UltiSnips loading. |
If anyone's interested the following setup works for me allowing me to lazy load Ultisnips & Vim-Snippets: set runtimepath+=~/.dotfiles
let g:UltiSnipsExpandTrigger="<tab>"
let g:UltiSnipsJumpForwardTrigger="<tab>"
let g:UltiSnipsJumpBackwardTrigger="<s-tab>"
let g:UltiSnipsSnippetsDir='~/.dotfiles/mysnippets'
let g:UltiSnipsSnippetDirectories=['UltiSnips', 'mysnippets']
NeoBundle 'honza/vim-snippets', {
\ 'lazy': 1,
\ 'autoload': {
\ 'on_source': ['ultisnips']
\}
\}
NeoBundle 'SirVer/ultisnips', {
\ 'lazy': 1,
\ 'autoload' : {
\ 'insert': 1
\ }
\ }
if neobundle#tap('ultisnips')
function! neobundle#hooks.on_source(bundle)
silent! call UltiSnips#FileTypeChanged()
endfunction
call neobundle#untap()
endif @SirVer would it be interesting to add as a PR to the readme? |
Nope, that is too fragile for me to support it. I can point users here now though.. |
@pgilad Thanks! I was looking for something similar. Do you know if it's possible to enhance this by loading only when UltiSnips is triggered and not just enter insert mode? |
Depends on what you mean by "UltiSnips is triggered" |
I mean, when you press |
Yeah it's definitely possible. I would look into NeoBundle |
Improve processing snippets
Hi, I'm using NeoBundle to lazy load Ultisnips and Vim-Snippets in the following way:
My intention is obviously to load Ultisnips only when going into insert mode, and then loading vim-snippets.
This works great the for supplied snippets in
honza/vim-snippets
but only after I re-open the current buffer, or edit a different buffer I can use my custom snippets.My custom snippets work great alongside the factory snippets if I don't lazy load Ultisnips. They are defined like so:
Any help on how to successfully lazy load both plugins and have them work the second I enter insert mode in the same buffer?
The text was updated successfully, but these errors were encountered: