nvimdev / dashboard-nvim

vim dashboard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Load session broken from dashboard

avegancafe opened this issue · comments

To preface this, I'm not sure if this is a bug in dashboard.nvim, so bear with me! Basically I'm using a combination of dashboard.nvim, neovim-session-manager, and workspaces.nvim, and I have this strange bug where when I try to restore the last session of the dir with neovim-session-manager while dashboard is open, it quits my vim. No error message or anything, vim just closes. The reason I am opening a ticket here is because this is the only place this happens-- if I open a file before trying to load a session, everything is fine.

Sorry for the long explanation, but I'm not really sure how to debug so I figured people might have some tips to debug a closing/crashing vim.

Here is my configuration, although it's also in fennel so sorry about that haha https://github.com/avegancafe/Juliet/blob/main/nvim/fnl/Juliet/plugins/utility/dashboard-nvim.fnl

hmm idk what happen with these plugins work together :)

Haha fair enough. My understanding of neovim-session-manager is that it's a pretty thin wrapper around native sessions so it might be a general problem with the dashboard. Do you know of any good ways to debug vim just crashing straight from dashboard?

Alright, I think this still migth be because of some awkward interaction between workspaces.nvim and dashboard.nvim, but I've at least found out an answer to my problem, in case anyone else ever has this same issue. When I'm setting up workspaces.nvim, I have this config:

workspaces.setup({
  hooks = {
    open_pre = function()
      local session_manager = require("session_manager")
      if (vim.api.nvim_buf_get_name(0) ~= "") then
        session_manager.save_current_session()
      end
      return true
    end,
    open = function(_workspace, path, _state)
      local command = ":cd " .. path .. " | tabNext | :q | SessionManager load_current_dir_session"
      return vim.cmd(command)
end
}} 

Specifically, that vim command in the open hook: vim.cmd(":cd " .. path .. " | tabNext | :q | SessionManager load_current_dir_session")

The specific unexpected weirdness is that for some reason, if I try to restore my current directory's session with SessionManager load_current_dir_session while dashboard.nvim is open, my vim will crash. I have to do a little awkward tabNext | :q | ... in order to quit out of the dashboard session before trying to restore the session. I'm trying to look into where the actual issue is (or awkward configuration matching), maybe in other plugins, but I'll open any MRs I can and link to this issue if I can