Shatur / neovim-session-manager

A simple wrapper around :mksession.
GNU General Public License v3.0
530 stars 52 forks source link

autocmd not working with error: attempt to call field "isarray" (a nil value). #127

Closed uncomfyhalomacro closed 5 months ago

uncomfyhalomacro commented 5 months ago

Commit https://github.com/Shatur/neovim-session-manager/commit/b3058f6ad6c69b20db3b375f7918ebd57e25aa4c broke the plugin

image

Workaround: Revert to https://github.com/Shatur/neovim-session-manager/tree/b552ee8667037be5d0291229279a35af25e515fb

Shatur commented 5 months ago

Can't reproduce on my machine. The error says that there is no isarray, but it exists.

MGliem commented 5 months ago

I had the same error. I was on neovim version 0.9.5 and vim.isarray() was missing (vim.islist() was also)

On 0.10.0 everything is fine.

i don't know why: https://neovim.io/doc/user/lua.html#vim.isarray(), it's not a specific 0.10 func.

(0.9.5 was installed on Fedora 39 using the official build/rpm)

If your distro doesn't ship yet neovim 0.10.0, you can use the appimage available on the official repo for now or revert to the previous commit.

Shatur commented 5 months ago

I was on neovim version 0.9.5 and vim.isarray() was missing (vim.islist() was also)

Yeah, the don't mention that it's from 0.10. I also check Neovim version and throw an error: https://github.com/Shatur/neovim-session-manager/blob/b3058f6ad6c69b20db3b375f7918ebd57e25aa4c/plugin/session_manager.lua#L1-L4

uncomfyhalomacro commented 5 months ago

ah then it's a version thing then. i should close. i didnt know this was for 0.10.0 😅

Shatur commented 5 months ago

Strange that the check didn't trigger for you...

niksingh710 commented 5 months ago

@Shatur for the neovim version is v0.10.0 still i am getting the error.

Shatur commented 5 months ago

Hm... I can't reproduce it on ArchLinux.

niksingh710 commented 5 months ago
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713773202

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

image this is my session manager

@Shatur below is minimal.lua from which i can reproduce the error nvim -u ./minimal.lua

-- Plugin manager
local lazypath = vim.fn.stdpath("data") .. "/lazy/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",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)
vim.opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" }
require("lazy").setup({
  {
    "Shatur/neovim-session-manager",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    -- event = "VeryLazy",
    lazy = false,
    opts = {
      autoload_mode = false,
    },
    keys = {
      { "<leader>S.", "<cmd>SessionManager load_last_session<CR>",        desc = "Last Session" },
      { "<leader>Sl", "<cmd>SessionManager load_session<CR>",             desc = "List Session" },
      { "<leader>Sd", "<cmd>SessionManager load_current_dir_session<CR>", desc = "Curr Dir load" },
      { "<leader>Ss", "<cmd>SessionManager save_current_session<CR>",     desc = "Save Session" },
      { "<leader>SD", "<cmd>SessionManager delete_session<CR>",           desc = "Delete sessions" },
    },
  },
})
Shatur commented 5 months ago

The issue in your configuration. You set autoload_mode = false, but instead it should be config.AutoloadMode.Disabled. See the readme.

niksingh710 commented 5 months ago

The issue in your configuration. You set autoload_mode = false, but instead it should be config.AutoloadMode.Disabled. See the readme.

aah, my bad, ig plugin has got some rework from the last time I went through the readme.

ty for the help working as expected.