How to get startify autosession and nerdtree working?

1 view
Skip to first unread message

Rudhra Raveendran

unread,
Jun 5, 2024, 1:10:07 PMJun 5
to spac...@googlegroups.com
Hi,

I'm new to using SpaceVim/vim plugins in general and I just want to have a setup similar to VS Code where when I open a folder, it restores the session that I had last (files open, position in file, etc.). I see that startify and NERDTree are both plugins installed and enabled by default in SpaceVim, so I'd assume they should play nice together, but I'm having some pretty annoying issues.

I wanted to setup auto session handling with startify following this info: https://github.com/mhinz/vim-startify/wiki/Example-configurations#auto-load-and-auto-save-a-session-named-from-git-branch. I also checked their FAQ for common issues and saw that it mentioned some issues with NERDTree and workaround commands, so I tried those too (sidenote, doing :h startify or :h startify-faq doesn't work, despite seeing startify.txt show up in the result for :h, what's up with that?).

However, the issue I'm getting despite trying those workarounds is when I start nvim without commands in a git repo (e.g in a folder ~/projectX on git branch Y I run nvim) it loads a corrupted session, where the file I was working on last is there on the left but without a tab title or syntax highlighting, and NERDTree loads as normal on the right, but in between these panels are empty windows that say NERDtree.

I also see errors like this:

Error detected while processing VimEnter Autocommands for "*"..function SpaceVim#welcome[11]..startify#insane_in_the_membrane[127]..User Autocommands for "StartifyReady"..function startify#session_load[29]..script /Users/rudhra.raveendran/.data/
nvim/session/projectx-branchy:
line  103:
E95: Buffer with this name already exists

And when I switch to the weird/broken NERDTree panels in the middle of my screen and try to close them, I get errors like this:

Error detected while processing function nerdtree#ui_glue#invokeKeyMap[1]..266[50]..265[5]..<SNR>166_closeTreeWindow[5]..405[22]..nerdtree#exec[9]..function nerdtree#ui_glue#invokeKeyMap[1]..266[50]..265[5]..<SNR>166_closeTreeWindow[5]..405[22].
.nerdtree#exec[6]..BufLeave Autocommands for "NERD_tree_*":
E121: Undefined variable: b:NERDTree

or

Error detected while processing function SpaceVim#mapping#SmartClose[18]..BufLeave Autocommands for "NERD_tree_*":
E121: Undefined variable: b:NERDTree

I've attached my init.toml and myspacevim.vim, would anyone be able to help me here?



Rudhra Raveendran
Software Engineer
781.605.8171

DoorDash.com

init.toml
myspacevim.vim

Eric Wong

unread,
Jun 6, 2024, 10:57:16 AMJun 6
to spacevim
I just check the link, It seems need another plugin called vim-gitbranch.vim, I do not want to include that into bundle list, because spacevim already provide function to get the current branch. BTW, the session file should not be generated in the root of project, this should in cache dir. I will implement this feature in SpaceVim. afte this has been done, people who want autosession feature, just need to enable the option, for example:

[options]
enable_auto_session = true

Reply all
Reply to author
Forward
0 new messages