snacks rice + new colorscheme

This commit is contained in:
iofq 2025-07-06 21:11:29 -05:00
parent 66d50e274e
commit d998429cb8
No known key found for this signature in database
GPG key ID: ECF3B2DA38BF7183
15 changed files with 1068 additions and 427 deletions

View file

@ -1,7 +1,8 @@
local M = {}
M.load = function()
sessions = require('mini.sessions')
M.get_id = function()
local jj_root = vim.system({ 'jj', 'workspace', 'root' }):wait()
local sessions = require('mini.sessions')
if jj_root.code ~= 0 then
return
@ -19,29 +20,42 @@ M.load = function()
'--no-graph',
})
:wait()
local branch = vim.trim(string.gsub(result.stdout, '[\n*]', ''))
local branch = vim.trim(string.gsub(result.stdout, '[\n*]', '')) -- trim newlines and unpushed indicator
local root = vim.trim(string.gsub(jj_root.stdout, '\n', ''))
local jj_sesh = string.gsub(string.format('jj:%s:%s', root, branch), '[./]', '-')
if jj_sesh ~= '' then
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. jj_sesh .. '.shada'
for name, _ in pairs(sessions.detected) do
if name == jj_sesh then
vim.ui.select({
'No',
'Yes',
}, { prompt = 'Session found at ' .. jj_sesh .. ', load it?' }, function(c)
if c == 'Yes' then
-- load session (buffers, etc) as well as shada (marks)
sessions.read(jj_sesh)
vim.cmd('rshada')
vim.notify('loaded jj session: ' .. jj_sesh)
end
end)
return
end
local id = string.gsub(string.format('jj:%s:%s', root, branch), '[./]', '-') -- slugify
return id
end
M.check_exists = function(id)
for name, _ in pairs(sessions.detected) do
if name == id then
return true
end
vim.cmd('wshada')
sessions.write(jj_sesh)
end
return false
end
M.load = function()
local id = M.get_id()
if id == '' then
return
end
vim.opt.shadafile = vim.fn.stdpath('data') .. '/myshada/' .. id .. '.shada'
if M.check_exists(id) then
vim.ui.select({
'Yes',
'No',
}, { prompt = 'Session found at ' .. id .. ', load it?' }, function(c)
if c == 'Yes' then
-- load session (buffers, etc) as well as shada (marks)
sessions.read(id)
vim.cmd('rshada')
vim.notify('loaded jj session: ' .. id)
end
end)
else
vim.cmd('wshada') -- create session if it did not exist
sessions.write(id)
end
end