Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Pinned buffers don't persist across sessions #649

Closed
1 task done
mokafolio opened this issue Dec 28, 2022 · 9 comments
Closed
1 task done

[Bug]: Pinned buffers don't persist across sessions #649

mokafolio opened this issue Dec 28, 2022 · 9 comments
Labels
bug Something isn't working

Comments

@mokafolio
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

When saving a session with pinned buffers, they are not restored when reloading the session.

What did you expect to happen?

I'd expect the pinned buffers to still be pinned after reloading the session.

Config

require("bufferline").setup({
    options = {
        show_close_icon = true,
        diagnostics = "nvim_lsp",
        always_show_bufferline = false,
        separator_style = "thick",
        offsets = {
            {
                filetype = "neo-tree",
                text = "Neo Tree",
                highlight = "Directory",
                text_align = "left"
            }
        }
    }
})

Additional Information

I can see that there is code to persist and restore pinned buffers insider groups.lua . I am not quite sure why it does not work or if there is a setting I am missing. I am using mini.sessions to save and reload (global) sessions. It internally just uses :mksession. Thank you!

commit

No response

@mokafolio mokafolio added the bug Something isn't working label Dec 28, 2022
@akinsho
Copy link
Owner

akinsho commented Dec 30, 2022

@mokafolio do your session options include globals?

@mokafolio
Copy link
Author

Amazing, that fixed it, I was not aware of sessionoptions. Thank you!

@basava70
Copy link

Amazing, that fixed it, I was not aware of sessionoptions. Thank you!

Hey,
where do I add set sessionoptions += globals ?
I have added this command in my init.lua but pinned buffers are still not being saved.
Can you help me ?

@mokafolio
Copy link
Author

this is what my sessionoptions look like: vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "globals", "folds", "terminal", "help" }

@basava70
Copy link

this is what my sessionoptions look like: vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "globals", "folds", "terminal", "help" }

Thanks for the reply, still didnt work. I pinned but after restarting nvim, its blank again. you mentioned groups.lua, where and what do you have in groups.lua?

@mokafolio
Copy link
Author

groups.lua is part of the library source that I was referencing, nothing to do there. You might be setting your options in the wrong place/time.

@basava70
Copy link

groups.lua is part of the library source that I was referencing, nothing to do there. You might be setting your options in the wrong place/time.

I am setting them in lua/options/init.lua
and require(options) before require(bufferline).

@mokafolio
Copy link
Author

do tabs save at all are only pinned tabs not working? How are you saving your sessions? Are you positive the sessions are actually properly saved?

@utkarshgupta137
Copy link
Contributor

I was facing the same problem, but I fixed it by starting bufferline before my session plugin.

lazy.vim:

{
  "olimorris/persisted.nvim",
  dependencies = {
    "akinsho/bufferline.nvim", -- <------ important ------
  },
  event = "VeryLazy",
  opts = {
    autoload = true,
  },
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants