MunifTanjim / nougat.nvim

🍫 Hyperextensible Statusline / Tabline / Winbar for Neovim 🚀
MIT License
197 stars 3 forks source link

Statusbar doesn't show on session restore. #50

Closed dsully closed 9 months ago

dsully commented 9 months ago

What information would be helpful to debug?

MunifTanjim commented 9 months ago

how is the session saved? and how is it restored?

dsully commented 9 months ago

I'm using stevearc/resession.nvim which doesn't use mksession- though I saw this behavior with mksession as well.

https://github.com/dsully/nvim/blob/main/lua/plugins/session.lua

This is what is saved:

{
    "buffers": [
        {
            "name": "/Users/dsully/.config/nvim/lua/plugins/init.lua",
            "last_pos": [38, 26],
            "options": {
                "filetype": "lua",
                "bufhidden": "",
                "modifiable": true,
                "binary": false,
                "readonly": false,
                "buflisted": true
            },
            "loaded": true
        }
    ],
    "quickfix": [],
    "tab_scoped": false,
    "tabs": [
        {
            "options": {
                "cmdheight": 0
            },
            "wins": [
                "leaf",
                {
                    "cursor": [38, 26],
                    "bufname": "/Users/dsully/.config/nvim/lua/plugins/init.lua",
                    "current": true,
                    "height": 54,
                    "options": {
                        "winfixheight": false,
                        "diff": false,
                        "previewwindow": false,
                        "scrollbind": false,
                        "winfixwidth": false
                    },
                    "width": 171
                }
            ]
        }
    ],
    "global": {
        "options": {
            "cmdheight": 0
        },
        "height": 55,
        "width": 171,
        "cwd": "/Users/dsully/.config/nvim"
    }
}

If I run mksession manually, then: nvim -S I get this error:

E5108: Error executing lua [string "v:lua"]:1: attempt to call global 'nougat_core_generator_fn' (a nil value)
stack traceback:
        [string "v:lua"]:1: in main chunk

In Session.vim:

$ grep statusline Session.vim
set statusline=%!v:lua.nougat_core_generator_fn(1)
setlocal statusline=
MunifTanjim commented 9 months ago

What's the output for :lua= vim.o.sessionoptions? 🤔

MunifTanjim commented 9 months ago

If I run mksession manually, then: nvim -S I get this error:

This happens if sessionoptions has options. You cannot do set statusline=%!v:lua.nougat_core_generator_fn(1) before the plugin is loaded.

You're getting

attempt to call global 'nougat_core_generator_fn' (a nil value)

because when statusline option is being set, nougat.nvim is not loaded yet.

dsully commented 9 months ago

Ok - that explains mksession. Any thoughts on stevearc/resession.nvim usage?

MunifTanjim commented 9 months ago

I couldn't reproduce it with ressession.nvim. If you can provide a minimal config I can use to reproduce the issue, that would be helpful.

(You can create a new bug report, you'll find the template for minimal config when creating the new issue.)

dsully commented 9 months ago

Got it sorted. I had an autocmd to hide the statusline when using alpha-nvim, but not to unhide it on BufUnload.