-
-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(vim-workspace): refactor configuration to be user configurable
- Loading branch information
Showing
1 changed file
with
43 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,46 @@ | ||
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, | ||
"thaerkh/vim-workspace", | ||
priority = 10000, | ||
lazy = false, | ||
specs = { | ||
{ "resession.nvim", enabled = false }, | ||
{ | ||
"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", | ||
callback = function() | ||
if vim.fn.exists ":Neotree" == 2 then vim.cmd.Neotree "close" end | ||
if vim.fn.exists ":NERDTreeClose" == 2 then vim.cmd.NERDTreeClose() end | ||
end, | ||
}, | ||
}, | ||
}, | ||
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, | ||
}, | ||
}, | ||
} |