I heavily use vim's session support to allow me to easily keep projects neatly organised, and to allow me to close vim down and still keep my editor in the same state (same files open, stuff like that).
For this I use the sessionman vim script.
Using this however, since I upgraded to MacVim 8.x from homebrew the following shows up as soon as I start typing:
Error detected while processing InsertCharPre Auto commands for "*":
E117: Unknown function: UltiSnips#TrackChange
If I open the same file directly from MacVim, all works without issues, it is only when opening from a session that things break.
Holy shit - same here! Can not edit anything anymore ^^
I probably also use some session vim plugin - but can't say it for sure - too many plugins over the years.
@bertjwregeer: I can't reproduce issue using sessionman.
Also, :mksession test.vim with following vim -S test.vim works too.
I am not sure how to check what is causing this issue then... my dotfiles repo is here: https://github.com/bertjwregeer/dotfiles
I am not familiar enough with vim to start debugging this. The only time this happens is if I save a session, and then restart the session.
@bertjwregeer: Try to comment out following lines (https://github.com/SirVer/ultisnips/blob/master/autoload/UltiSnips.vim#L1-L3) and try to reproduce the bug?
I'm experiencing the same problem. My session manager is https://github.com/xolox/vim-session.
This bug prevents me from using ultisnips.
@seletskiy: I've done some digging and found the problem seems to occur in ultisnips/autoload/UltiSnips.vim on the second call to exec (https://github.com/SirVer/ultisnips/blob/master/autoload/UltiSnips.vim#L8). This call never returns, so UltiSnips#TrackChange never gets defined.
@seletskiy: To elaborate, it seems like autoload/UltiSnips.vim is unable to import the UltiSnips python module in any way. from UltiSnips import UltiSnips_Manager fails, but also import UltiSnips fails, and
python << endpython
import UltiSnips
endpython
It seems like the plugin's pythonx directory is not in the PYTHONPATH in MacVim, or something to that effect. If I put in a try: and except: around the import call, I catch an exception which says "No module named UltiSnips".
Perhaps this is a change in behaviour in MacVim? I think this problem started for me when I upgraded to MacVim 8. I'm currently running MacVim 8.0 (119).
@joshcameron: If will you find any workaround for your system, it will be great! I can't help before that because I do not use MacVim.
I'm having this issue with standard non-macvim vim as well (also built using Homebrew on macOS).
I have this problem as well with macvim. However, I am on the way to solve the issue of command-t by upgrading my ruby version to 2.3 and reinstall my macvim with
brew reinstall macvim --HEAD --with-cscope --with-lua --with-override-system-vim
And horray, it fixed ultisnips, but still cannot fix the command-t !!!!
I reinstalled macvim as suggested by @bubuzzz, which did not solve my problem. Then I did an rm -rf ~/.vim/bundle/ultisnips and reinstalled it in a new vim instance using :PluginInstall, and now my snippets are working again. I'm not sure whether reinstalling macvim was necessary. While debugging this problem, I did receive errors about .pyc files having invalid magic numbers. So perhaps the compiled python in the plugin got into a bad state or the version of python being used by macvim changed when I upgraded it? I don't know. It's unlikely I'll investigate further, since everything is working properly for me again. Hopefully this and/or @bubuzzz's fix will help other people with the same problem.
One other theory about how I hit this problem: macvim occasionally prompts me to upgrade when a new version is available. I wonder if upgrading via the GUI is a _Bad Thing_ when macvim was originally installed using brew.
Same problem here. I have multiple snippets and other plugins. I generated this error when I installed a new snippets plugin (vim-bootsrtap4-snippets). My solution was to delete my sessions folder. reinstall new bootstrap-snippets plugin and bingo all working.
Perhaps this might help, I've been struggling with UltiSnips and sessions, and I have a potential work around that worked for me at least.
I am using GVim 8.0 on Windows 10.
Instead of using the regular :mksession, I've switched to using Tim Pope's obsession.vim plugin. I also noted the changes I made in this Stack Overflow answer. I was then able to load the Session.vim file as normal, either through source Session.vim or -S Session.vim and UltiSnips would work.
In the readme he notes that when saving the Session:
- Don't capture options and maps. Options are sometimes mutilated and maps just interfere with updating plugins.
I wonder if upgrading via the GUI is a Bad Thing when macvim was originally installed using brew
@joshcameron Yes, it is. Your linked python version will go out of sync then, leading to weird bugs.
The tl;dr from this thread seems to be: On new Vim version, reinstall UltiSnips (likely to get newly generated .pyc files) and recreate your sessions seem to be able to fix issues. Also, see https://github.com/SirVer/ultisnips/issues/771#issuecomment-377815616 for dangers around updating MacVim in brew.
In general, Vim's sessions are an undercooked feature and I do not suggest using them, instead use obsession.vim. See also https://stackoverflow.com/questions/37984348/make-session-settings-saving-function-play-nice-with-ultisnips.
Closing this issue as answered.
I encountered this. The problem was that I built Vim from source, and then I upgraded homebrew which upgraded python2, and it caused this to start happening. This thread hinted me into the solution which is to rebuild Vim again from source with the updated python2.
I have this same issue with the current master in vim 8.2.
Using an older version (I tried 38b60d8e149fb38776854fa0f497093b21272884) makes the problem go away.
Rebuilding vim did not help for me.