echasnovski / mini.nvim

Library of 40+ independent Lua modules improving overall Neovim (version 0.8 and higher) experience with minimal effort
MIT License
5.18k stars 187 forks source link

Mini.Sessions - save_current() #48

Closed JoseConseco closed 2 years ago

JoseConseco commented 2 years ago

Contributing guidelines

Module(s)

Mini.Sessions

Description

There is no manual way to save session - only on quit (well there is session.write() but you would have to write current session name). Problem is as follows:

If we could run session.save_current() before calling mini.starter then problem is solved.

Even better if opening mini.starter() would save current session - it would have to be done, before mini.staarter() overrides current buffer content, so that we wont save mini.starter screen in session file. I think startify did it best - when opening startify screen, it would:

echasnovski commented 2 years ago

MiniSessions.write() writes current session (specified in v:this_session). This is basically what is done on VimLeavePre. Is this what you are looking for?

I don't think 'mini.starter' should do any saving upon opening. Probably the best way here is to use manual command for opening Starter buffer or on MiniStarterOpened event.

JoseConseco commented 2 years ago

Yes - I did not know you can pass nil, to save current seesion. That is what I was missing. I guess it matter of preferences - but I like Startify method - where if you call Startif start screen - it save and close current session, buff delete all, and open new clean startify screen. But I can recreate this now.
Still having this as MiniSessions.save_current() would be cool IMO.