feat: sessions per branch. Closes #9

This commit is contained in:
Folke Lemaitre 2024-07-06 22:00:20 +02:00
parent 9c0e5227fa
commit cd0054e6a4
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
3 changed files with 17 additions and 1 deletions

View file

@ -10,6 +10,12 @@ local e = vim.fn.fnameescape
function M.current()
local name = vim.fn.getcwd():gsub("[\\/:]", "%%")
if Config.options.branch then
local branch = M.branch()
if branch and branch ~= "main" and branch ~= "master" then
name = name .. "-" .. branch
end
end
return Config.options.dir .. name .. ".vim"
end
@ -111,4 +117,10 @@ function M.select()
end)
end
--- get current branch name
---@return string?
function M.branch()
return vim.fn.systemlist("git branch --show-current")[1]
end
return M