Skip to content

Commit

Permalink
refactor(vim-workspace): refactor configuration to be user configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Dec 20, 2024
1 parent eee957e commit d766f5e
Showing 1 changed file with 37 additions and 22 deletions.
59 changes: 37 additions & 22 deletions lua/astrocommunity/session/vim-workspace/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,44 @@ return {
{ "resession.nvim", enabled = false },
{
"thaerkh/vim-workspace",
enabled = true,
priority = 10000,
lazy = false,
init = function()
vim.cmd [[
let g:workspace_autosave_ignore = ['gitcommit', "neo-tree", "nerdtree", "qf", "tagbar"]
let g:workspace_session_disable_on_args = 1
let g:workspace_session_directory = stdpath("cache") . '/vim-workspace.sessions'
let g:workspace_undodir= stdpath("cache") . "/vim-workspace.undodir"
let g:workspace_autocreate = 1
" nnoremap <leader>W :ToggleWorkspace<CR>
autocmd VimLeave *
\ if exists(":Neotree") | execute 'Neotree close' | endif |
\ if exists(":NERDTreeClose") | execute 'NERDTreeClose' | endif
let g:workspace_create_new_tabs = 0
" Because a bug, these two populate search / history, just disable them.
let g:workspace_autosave_untrailtabs = 0
let g:workspace_autosave_untrailspaces = 0
let g:workspace_nocompatible = 0
let g:workspace_session_disable_on_args = 1
" https://github.com/thaerkh/vim-workspace/issues/11
set sessionoptions-=blank
]]
end,
specs = {
{
"AstroNvim/astrocore",
---@param opts AstroCoreOpts
opts = function(_, opts)
local sessionoptions = {} -- https://github.com/thaerkh/vim-workspace/issues/11
for _, value in ipairs(vim.tbl_get(opts, "options", "opt", "sessionoptions") or vim.opt.sessionoptions:get()) do
if value ~= "blank" then table.insert(sessionoptions, value) end
end
return require("astrocore").extend_tbl(opts, {
autocmds = {
autoclose_neotree = {
{
event = "VimLeave",
command = [[ if exists(":Neotree") | execute 'Neotree close' | endif | if exists(":NERDTreeClose") | execute 'NERDTreeClose' | endif ]],
},
},
},
options = {
opt = { sessionoptions = sessionoptions },
g = {
workspace_autosave_ignore = { "gitcommit", "neo-tree", "nerdtree", "qf", "tagbar" },
workspace_session_disable_on_args = 1,
workspace_session_directory = vim.fn.stdpath "cache" .. "/vim-workspace.sessions",
workspace_undodir = vim.fn.stdpath "cache" .. "/vim-workspace.undodir",
workspace_autocreate = 1,
workspace_create_new_tabs = 0,
-- Because a bug, these two populate search / history, just disable them.
workspace_autosave_untrailtabs = 0,
workspace_autosave_untrailspaces = 0,
workspace_nocompatible = 0,
},
},
})
end,
},
},
},
}

0 comments on commit d766f5e

Please sign in to comment.