TaDaa / vimade

An eye friendly plugin that fades your inactive buffers and preserves your syntax highlighting!
MIT License
486 stars 8 forks source link

Load session lost syntax #67

Open sphynx79 opened 2 years ago

sphynx79 commented 2 years ago

I use this plugin perfectly, but when i try use with auto-session plugin, reload session broke Vimade visualization This is my sessionoptions:

vim.opt.sessionoptions = { "blank", "buffers", "curdir", "folds", "help", "tabpages", "winsize", "resize", "winpos", "terminal" }

and this is my configuration:

vim.g.vimade = {
  fadelevel = 0.6,
  usecursorhold = 1,
  enabletreesitter = 1,
  enablesigns = 1
}

require("util").define_augroups {
  _vimade = {
    {
      "FileType",
      "nerdtree,vista,neoterm,dapui_scopes,dapui_breakpoints",
      "VimadeBufDisable",
    },
  }
}
local M = {}

local function closeNerdTree()
  if (vim.api.nvim_call_function('exists', {"t:NERDTreeBufName"}) == 1 and vim.fn.bufwinnr(vim.t.NERDTreeBufName) ~= -1) then
    vim.cmd([[NERDTreeClose]])
  end
  vim.cmd([[VimadeDisable]])
end

local function enableVimade()
  vim.cmd([[VimadeEnable]])
end

local opts = {
  auto_session_enabled = true,
  auto_save_enabled = false,
  auto_restore_enabled = false,
  pre_save_cmds = { closeNerdTree },
  post_save_cmds = { enableVimade }
}

function M.setup()
  require('auto-session').setup(opts)
end

return M

https://user-images.githubusercontent.com/5004160/141167277-c5df7e12-0b15-4a27-8fa2-46b33e3de47f.mp4