mhinz / vim-startify

:link: The fancy start screen for Vim.
MIT License
5.31k stars 187 forks source link

May I reuse the same "Startify-View_File" across Ubuntu and Windows? #337

Closed llinfeng closed 5 years ago

llinfeng commented 6 years ago

My daily driver is a Windows 10 machine, and I am experimenting the "Windows Subsystem for Linux" on it. I have got ubuntu.exe installed, and have made Vim to source its configuration files (*.vim) from the Windows OS.

Cannot open Windows-saved sessions on Ubuntu-Vim

Now, I get the following error when I try to load existing sessions from Startify when I am in the Vim hosted by "Ubuntu on Windows": startify_trailing_char

Please advise what to specify when it comes to how Vim saves these views.

Cannot open Ubuntu-saved session on Windows-Gvim

I have also tried to save a Startify session on the Ubuntu-vim, and it worked well: I can save and load it within the Ubuntu Vim environment. Yet, I got the following error when trying to load such "Ubuntu-saved" session on Windows-Gvim open_ubuntu_session_from_gvim

Observation

It is clear that the sessions saved by each OS are OS-specific:

Looking forward to a way to summon the sessions irrespective of the OS.

mhinz commented 6 years ago

Sorry, but I almost never use Windows and never used WSL so far.

The way sessions are saved can be influenced with :h 'ssop'. It mentions:

    "slash" and "unix" are useful on Windows when sharing session files
    with Unix.  The Unix version of Vim cannot source dos format scripts,
    but the Windows version of Vim can source unix format scripts.

You probably have to play around with these values.

If you ever need to change where Startify saves sessions, use :h g:startify_session_dir. Maybe use different values for Win and Ubuntu. (Although that should be the default for both OS, but then again I have no idea how WSL really works.)

llinfeng commented 6 years ago

Thank you for pointing out that I shall tell Startify to source different startify_session_dir. Indeed, WSL has its own set of ~/.vimrc files, and I can thus direct Startify to source a different folder for WSL. And, here goes a few good reasons for leaving the session files native to the file-system:

However, here go a few observation that I see as opportu nities to have a saved-session shareable across OS/build:

PS: per my understanding of how sessions are saved, I call files that I store in startify_session_dir as "session files".

mhinz commented 5 years ago

Except for 'sessionoptions' I can't influence how sessions get saved.

It's not guaranteed that the session file used a relative path as in your example. For both points you mentioned one would have to open/edit/save/close them again. That would always be an ugly hack.

This approach would have many corner cases and I consider this use case uncommon enough so that it doesn't warrant the time for new code. The cost-benefit isn't worthwhile here.

Especially since this plugin is not a full-fledged plugin for managing sessions. It provides a start screen and its session saving capabilities are just a way to easily save all sessions to the same directory, so that Startify can list them in the start screen.

Thanks for bringing this up anyway! ✨