|
| 1 | +return { |
| 2 | + "thaerkh/vim-workspace", |
| 3 | + priority = 10000, |
| 4 | + lazy = false, |
| 5 | + specs = { |
| 6 | + { "resession.nvim", enabled = false }, |
| 7 | + { |
| 8 | + "AstroNvim/astrocore", |
| 9 | + ---@param opts AstroCoreOpts |
| 10 | + opts = function(_, opts) |
| 11 | + local sessionoptions = {} -- https://github.com/thaerkh/vim-workspace/issues/11 |
| 12 | + for _, value in ipairs(vim.tbl_get(opts, "options", "opt", "sessionoptions") or vim.opt.sessionoptions:get()) do |
| 13 | + if value ~= "blank" then table.insert(sessionoptions, value) end |
| 14 | + end |
| 15 | + return require("astrocore").extend_tbl(opts, { |
| 16 | + autocmds = { |
| 17 | + autoclose_neotree = { |
| 18 | + { |
| 19 | + event = "VimLeave", |
| 20 | + callback = function() |
| 21 | + if vim.fn.exists ":Neotree" == 2 then vim.cmd.Neotree "close" end |
| 22 | + if vim.fn.exists ":NERDTreeClose" == 2 then vim.cmd.NERDTreeClose() end |
| 23 | + end, |
| 24 | + }, |
| 25 | + }, |
| 26 | + }, |
| 27 | + options = { |
| 28 | + opt = { sessionoptions = sessionoptions }, |
| 29 | + g = { |
| 30 | + workspace_autosave_ignore = { "gitcommit", "neo-tree", "nerdtree", "qf", "tagbar" }, |
| 31 | + workspace_session_disable_on_args = 1, |
| 32 | + workspace_session_directory = vim.fn.stdpath "cache" .. "/vim-workspace.sessions", |
| 33 | + workspace_undodir = vim.fn.stdpath "cache" .. "/vim-workspace.undodir", |
| 34 | + workspace_autocreate = 1, |
| 35 | + workspace_create_new_tabs = 0, |
| 36 | + -- Because a bug, these two populate search / history, just disable them. |
| 37 | + workspace_autosave_untrailtabs = 0, |
| 38 | + workspace_autosave_untrailspaces = 0, |
| 39 | + workspace_nocompatible = 0, |
| 40 | + }, |
| 41 | + }, |
| 42 | + }) |
| 43 | + end, |
| 44 | + }, |
| 45 | + }, |
| 46 | +} |
0 commit comments