dhruvasagar / vim-prosession

Handle vim sessions like a pro
254 stars 22 forks source link

Switching session does not respect `exrc` option #41

Closed TSFoster closed 6 years ago

TSFoster commented 6 years ago

Hi,

I have set exrc in ~/.vimrc. When I switch session via :Prosession /path/to/dir, /path/to/dir/.[n]vimrc doesn't seem to be executed. Am I right in thinking that? Is it possible to have that happen, or would it lead to problems?

Thanks,

Toby

Neovim v0.2.2 macOS 10.13.3

dhruvasagar commented 6 years ago

Hi,

I am aware of this and I believe this is more of a 'vim' limitation since the exrc option triggers only during vim startup, switching sessions isn't exactly that and so it doesn't get sourced. I could potentially do this but not sure if it would be entirely safe.

TSFoster commented 6 years ago

I guess there would be no way to "un-read" a local .vimrc, so switching out of a project keeps the custom .vimrc config?

Thanks for the help!

dhruvasagar commented 6 years ago

Yeap that is also true

dhruvasagar commented 6 years ago

What can be done is perhaps add custom autocmds for before & after session swap. Those can then be used for executing custom logic such as this, for eg.) you could source a .vimrc.leave before switch from the previous directory and a .vimrc.enter file when you enter a directory (session).

TSFoster commented 6 years ago

Good idea!

I think there is a relevant event (DirChanged) in Neovim, and possibly in newer versions of vim

dhruvasagar commented 6 years ago

I'll close this issue for now, try making use of these custom events perhaps for your use case. If you face any issues reopen this issue and i'll take a look at it.

dhruvasagar commented 6 years ago

The last commit was referenced to this issue incorrectly.