xolox/vim-session

Question: Windows vim and Cygwin vim

raghur opened this issue · 3 comments

Hi,
First of all thanks for the great plugin. I've recently started using both windows gvim and cygwin vim and obviously the session plugin barfs since the filepaths are no longer loadable.
I've resorted to disabling vim-session in Cygwin. However, wanted to check if you'd be willing to consider implementing something like this in the plugin

  1. in the session file, store the os on which it was created (win32 or win32unix)
  2. while loading, only load last saved session if the os matches
  3. If it doesn't then load last saved session for the OS?

My vimscript fu is extremely limited - hence the request. If you think its too esoteric, then I completely understand :)

Hi and sorry for the late response.

Disclaimer: I've never actually used Cygwin, however I am pretty experienced in both Windows and UNIX and I know how Cygwin is supposed to give you an emulated UNIX environment on Windows.

With that out of the way: I don't really get how you can run into this issue with a 'default setup'. Vim on Windows will load ~\_vimrc while Cygwin Vim should load ~/.vimrc. Same goes for the profile directories ~\vimfiles vs ~/.vim. So the session directories wouldn't be shared by default, would they? Or am I misunderstanding how Cygwin works?

If I were using Cygwin I would have both Windows Vim and Cygwin Vim ultimately load the same vimrc file using Vim's :source command (my vimrc is a couple thousand lines and portable between Windows, Linux and Mac OS X so I certainly wouldn't want to repeat that for each platform and keep the files in sync manually) but I would use the platform specific vimrc scripts to set platform specific settings, for example I would set the session_directory option to different values for Windows Vim vs Cygwin Vim.

You wouldn't be able to share the sessions between both environments, but that will never work anyway (given how the vim-session plug-in works) so you're not really missing out on anything :-)

If this helps I could add a note to the readme explaining this setup. What do you think?

I'm using the same vimrc file for both windows gvim and cygwin vim. But your post did help out...

for example I would set the session_directory option to different values for Windows Vim vs Cygwin Vim.

I hadn't dug into that - so yeah - that'll work pretty well.. Will try it out.

Thanks for the follow up @raghur, I added a note to the readme / homepage to make it easier for others to find out how to deal with this. Thanks for the feedback and happy Vimming!