nvim-config/lua/configs/session-manager.lua

32 lines
856 B
Lua
Raw Normal View History

2022-10-26 17:03:13 +00:00
local M = {}
function M.config()
local status_ok, session_manager = pcall(require, "session_manager")
if not status_ok then
return
end
local sm_config = require'session_manager.config'
-- this plugin saves sessions for the working directory automatically
session_manager.setup({
autoload_mode = sm_config.AutoloadMode.Disabled, -- do not auto-load the last session at startup
extras_generator = function(dir)
local handle = io.popen("git branch --show-current 2>/dev/null")
if (handle == nil) then
return nil
end
local branch = handle:read("l")
handle:close()
if (branch == nil) then
return nil
end
branch = branch:gsub("/", "++")
return branch
end,
2022-10-26 17:03:13 +00:00
})
end
return M