arena.nvim icon indicating copy to clipboard operation
arena.nvim copied to clipboard

[bug] Possible bug: arena not picking up open buffers on session restore or [feature] restore session

Open gipo355 opened this issue 1 year ago • 8 comments

Hey! not sure if this is the intended behavior.

I usually restore the session using persistence.nvim from folke which restores all last open buffers.

if i open telescope buffers, they all show up.

if i open arena, i only get the currently opened file at start.

it looks like arena only registers items when you actively open them instead of picking up open buffers.

gipo355 avatar Oct 03 '23 07:10 gipo355

Yeah, arena activates on BufWinEnter, which I think is good from a frecency standpoint. BufEnter just activated too much. It doesn't make much sense to update scores when the user just moves between split windows.

I don't have a super good idea for how to fix this, so if you have any thoughts let me know!

dzfrias avatar Oct 04 '23 01:10 dzfrias

Is possibly adding an option to populate arena with open buffers a bad idea? Wouldn't the results start sorting themselves out once I start moving into them?

gipo355 avatar Oct 04 '23 05:10 gipo355

My use case is a bit similar, I use persistence to always keep the same files open after closing Vim, but when I installed Arena I thought the buffers I'd open would persist on it after closing, (similar to Harpoon), but when testing this I saw that it works great until you close Vim, then the next time you open, the arena buffer only contains the currently open file. Not sure if this relates to sessions, or if it was designed to be that way, but would be good to have a persistent list like Harpoon, which I like, but I always end up forgetting to manually add the files, which is why I thought automating it would be better and was interested in this plugin

GabeDuarteM avatar Oct 05 '23 13:10 GabeDuarteM

possibly populate arena with open buffers IF arena items <= 1 and IF there are open buffers?

gipo355 avatar Oct 05 '23 14:10 gipo355

Not sure if this relates to sessions, or if it was designed to be that way, but would be good to have a persistent list like Harpoon, which I like, but I always end up forgetting to manually add the files, which is why I thought automating it would be better and was interested in this plugin

Hmm, I see. That's a good use-case, but arena was designed with the intent of not being persistent, and just being a buffer-switcher. There's a great frecency-based plugin, telescope-frecency, that is persistent!

The main case for arena.nvim was to be ephemeral, and just use it as a smart and painless way to manage buffers in an existing editing instance. I think there are already great plugins, like the one I linked above, that satisfy the persistence use-case.

That being said, I like the idea of integrating better with sessions.

dzfrias avatar Oct 05 '23 14:10 dzfrias

possibly populate arena with open buffers IF arena items <= 1 and IF there are open buffers?

There's an autocommand, SessionLoadPost, that triggers after a session has been loaded. After it's been loaded, we could populate the arena with open buffers.

The only thing I don't like about this implementation is that it doesn't keep the actual frecency scores...

dzfrias avatar Oct 05 '23 14:10 dzfrias

yeah i understand your concerns. This is why i thought of adding buffers only if there is only 1 arena item in the list.

the thing that happens most frequently for me is closing and reopening quickly with let's say 5 buffers and restoring them.

everytime i reach out to arena but find it empty and have to move to tel buffers.

gipo355 avatar Oct 05 '23 14:10 gipo355

I see. Although it's not perfect, I'll go with the SessionLoadPost implementation. That way, at least some data can be restored!

dzfrias avatar Oct 05 '23 14:10 dzfrias

+1, it would be really cool to restore arena buffers, the same as persistence does on session restoration

kryptamine avatar Jul 21 '24 13:07 kryptamine

Done as of ef869e4! I haven't tested it on session plugins like persistence.nvim, but as long as it uses the SessionLoadPost autocommand, it should work!

dzfrias avatar Jul 22 '24 22:07 dzfrias