Closed abenz1267 closed 1 year ago
Good afternoon and thank you for your suggestions!
a simple "save()" command would be great. I don't see the need to 2 different keybinds
this is true except for the case when you want to create a new session in the same working directory, different from the one you originally opened. For instance think at the case where you have several git branches with different files and you want to associate different sessions (this was actually my initial use case).
A little bug: one cannot call "possession.list()" in the init function of lazy. You'll be in insert mode, but in the buffer and not the fzf window.
hmm, I do just that in my config and it works fine. Could you show your lazy configuration, both for nvim-session and for fzf-lua? I have the feeling that it may depend on the fact that fzf-lua is lazy loaded after nvim-possession.
Additionally it'd be nice to be able to pass a string to the create/save function directly, so you can f.e. auto-create/update sessions when exiting nvim. F.e. last part of pwd or something.
Can you expand what you mean here? At the moment you do pass a string when creating a new session (the name of the session): in what other circumstance do you want to do so?
Small other thing: currently all session buffers are being displayed, is it possible to just show tabs?
do you mean that you want to restore the different tabs when loading the session as you had when saving it?
this is true except for the case when you want to create a new session in the same working directory, different from the one you originally opened. For instance think at the case where you have several git branches with different files and you want to associate different sessions (this was actually my initial use case).
Yes, this makes sense, but for other cases it'd be good to have 1 keybind for both. F.e. i use git worktree's a lot so i have a different folder for every branch anyways.
hmm, I do just that in my config and it works fine. Could you show your lazy configuration, both for nvim-session and for fzf-lua? I have the feeling that it may depend on the fact that fzf-lua is lazy loaded after nvim-possession.
Am i blind? In your linked config you don't call possession.list()
anywhere. You have the keymap set and that's it. I tried putting possession.list()
into the init func of fzf-lua and it behaves the same: list opens, insert mode in buffer and not fzf. Like.. i mean literally running "possession.list()" when nvim opens.
Can you expand what you mean here? At the moment you do pass a string when creating a new session (the name of the session): in what other circumstance do you want to do so?
So i can create an autocmd that creates/updates a session when closing nvim. Right now i have to manually create a session and give it a name.
do you mean that you want to restore the different tabs when loading the session as you had when saving it?
No no, i mean: the preview windows lists all buffers right now. I just want to see tabs.
In your linked config you don't call possession.list() anywhere. You have the keymap set and that's it.
Isn't this what you meant or did I misunderstand? Are you saying that defining the command in the init
option of lazy makes it misbehave (this was my initial understanding) or something else?
I tried putting possession.list() into the init func of fzf-lua and it behaves the same: list opens
You should not put possession.list()
anywhere else other than when defining it: can you describe what you are trying to achieve? Are you trying to start the list of sessions upon VimEnter
? In general however what possession.list()
does is nothing but invoking fzf.files
with extra options to parse the sessions (see here), hence whether or not it focuses on the fzf popup window depends on fzf configurations (or other setups you may have).
So i can create an autocmd that creates/updates a session when closing nvim
This is achieved already with the autosave = true
option active by default: why are you creating an additional autocommand (just to understand what use cases you are on)?
No no, i mean: the preview windows lists all buffers right now. I just want to see tabs.
This depends on your sessionoptions
values: see :h sessionoptions
. Defaults are
sessionoptions=blank,buffers,curdir,folds,help,tabpages,winsize,terminal
if I am not mistaken: if you only want to see tabs you should remove buffers
.
Are you trying to start the list of sessions upon VimEnter?
yes. exactly.
This is achieved already with the autosave = true option active by default: why are you creating an additional autocommand (just to understand what use cases you are on)?
-- whether to autosave loaded sessions before quitting
That's what autosave does according to the readme. It does not create/prompt to create a new session. But i already made a proper autocmd. I'm simply calling "require'nvim-possession'.status()" on exit and invoke create if no session is present.
if I am not mistaken: if you only want to see tabs you should remove buffers.
That worked!
Yeah, function new
doesnt accept a provided input string right now. Would be good if it would, so one can call "possession.new("somename")".
Are you trying to start the list of sessions upon VimEnter? list opens, insert mode in buffer and not fzf
I have set up the autocommand myself for demonstration, see screenshot below: it does focus on the fzf window: are you sure you don't have other conflicting focus commands that may take over?
It does not create/prompt to create a new session. Yeah, function new doesnt accept a provided input string right now. Would be good if it would, so one can call "possession.new("somename")".
Now that I understand your workflow with autocommands, in those cases you should just call :mksession <somename>
in your autocommand callback, not possession.new
. This is because what nvim-possession does is essentially providing a browsing/interactive experience around the :mksession
command; if you are already setup with autocommands then you would be better off by passing in the native vim functions for them (the purpose of the plugin is not to replace the native functionality, rather to offer an interactive experience).
I'm simply calling "require'nvim-possession'.status()" on exit
More simply, you can check for the value of the variable vim.g["session"]
: this holds the name of the current session or nil
(so you spare having to call a function require instead).
Anything else we want to address in this issue or can we close it?
Hi,
i have a little suggestion:
a simple "save()" command would be great. I don't see the need to 2 different keybinds. If no session is detected, simply prompt for the new session's name. If a session is loaded, just update.
Additionally it'd be nice to be able to pass a string to the create/save function directly, so you can f.e. auto-create/update sessions when exiting nvim. F.e. last part of pwd or something.
A little bug: one cannot call "possession.list()" in the init function of lazy. You'll be in insert mode, but in the buffer and not the fzf window.
Small other thing: currently all session buffers are being displayed, is it possible to just show tabs?
Regards