-
-
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.
feat(session): add vim-workspace plugin and session directory (#1289)
* feat(session): add vim-workspace plugin and session directory * refactor(vim-workspace): refactor configuration to be user configurable --------- Co-authored-by: Micah Halter <micah@mehalter.com>
- Loading branch information
Showing
2 changed files
with
60 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# vim-workspace | ||
|
||
Automated Vim session management with file auto-save and persistent undo history | ||
|
||
The configuration of the plugin: | ||
|
||
- disable resession.nvim - default astronvim session management | ||
- auto create and auto load the workspace when neovim was started without any arguments | ||
- just `cd dir` and `nvim` to start the workspace | ||
- auto save the workspace when neovim was closed | ||
- handle neotree, NERDTree, git windows | ||
- fix paths to use cache path of neovim | ||
|
||
**Repository:** <https://github.com/thaerkh/vim-workspace> |
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
return { | ||
"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, | ||
}, | ||
}, | ||
} |