folke / persistence.nvim

💾 Simple session management for Neovim
Apache License 2.0
655 stars 25 forks source link

bug: #38

Closed jchilders closed 10 months ago

jchilders commented 10 months ago

Did you check docs and existing issues?

Neovim version (nvim -v)

NVIM v0.9.4

Operating system/version

macOS Sonoma 14.11

Describe the bug

Getting the following error when trying to persist a session:

E5108: Error executing lua ....repro/plugins/persistence.nvim/lua/persistence/init.lua:67: bad argument #1 to 'concat' (table expected, got nil)
stack traceback:
        [C]: in function 'concat'
        ....repro/plugins/persistence.nvim/lua/persistence/init.lua:67: in function 'save'
        [string ":lua"]:1: in main chunk

A similar error occurs when attempting to load a session.It appears that it is not finding the table builtin.

Steps To Reproduce

  1. Use minimal init.lua as given below.
  2. Hit <Leader>qs or <Leader>ql

Expected Behavior

Session is saved or loaded without error.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({ "git", "clone", "--filter=blob:none", "https://github.com/folke/lazy.nvim.git", lazypath, })
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  "folke/tokyonight.nvim",
  "folke/persistence.nvim",
  -- add any other plugins here
}
require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here

vim.keymap.set("n", "<leader>qs", "<cmd>wa<CR><cmd>lua require('persistence').save()<CR>")
vim.keymap.set("n", "<leader>ql", "<cmd>wa<CR><cmd>lua require('persistence').load()<CR>")
b0ae989c commented 10 months ago

This is not an issue with persistence.nvim. In your config, you didn't use the default opts. Please add config = true as follows

{
  "folke/persistence.nvim",
  config = true,
}
jchilders commented 10 months ago

Thank you, that was it.