Comments (7)
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?
from nvim-possession.
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.
from nvim-possession.
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
.
from nvim-possession.
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!
from nvim-possession.
Yeah, function new
doesnt accept a provided input string right now. Would be good if it would, so one can call "possession.new("somename")".
from nvim-possession.
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?
Screen.Recording.2023-01-30.at.17.11.25.mov
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).
from nvim-possession.
Anything else we want to address in this issue or can we close it?
from nvim-possession.
Related Issues (20)
- nvim-tree not loading when restoring a session HOT 9
- About vimscript configuration issues HOT 11
- tag the rockspec with the "neovim" label. HOT 4
- Expose a delete() function HOT 6
- Bad filepath error (No such file or directory) HOT 24
- Files that are deleted still shows in session file. HOT 11
- The autoload setting makes the loaded buffer innactive HOT 1
- How to "close" session? HOT 9
- Breaks on terminal HOT 14
- Bug in README with lualine HOT 2
- Plugin doesn't work HOT 9
- autoload cause double lualine in lazyvim HOT 4
- Close session HOT 9
- Auto-create session path HOT 3
- autoload doesn't work HOT 7
- Add auto-restore base on current dir, aware of neo-tree? HOT 8
- Add auto save on event, i.e: VimExit? HOT 4
- Switch session will clean up buffers from current session? HOT 8
- Decouple fzf-lua to a plugin? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nvim-possession.