Remove git dependency on jj snacks

This commit is contained in:
2026-07-30 00:01:40 +02:00
parent 2301b2d9ed
commit 0df3d43837
2 changed files with 24 additions and 8 deletions
+5 -8
View File
@@ -123,8 +123,7 @@ Snacks.picker.jj_log = function(file)
)
return
end
-- local cmd = { 'jj', 'log', '-r=' .. ctx.item.change_id, "--git" }
local cmd = { "git", "show", ctx.item.commit }
local cmd = { "jj", "show", "--git", "--no-pager", "-r", ctx.item.change_id }
Snacks.picker.preview.cmd(cmd, ctx, { ft = "git" })
end,
confirm = function(picker, item)
@@ -158,11 +157,11 @@ Snacks.picker.jj_log = function(file)
end,
jj_gsplit = function(picker, item)
picker:close()
vim.cmd('Gsplit ' .. vim.fn.fnameescape(item.commit .. ':' .. file))
vim.cmd({ cmd = "Jsplit", args = { item.change_id .. ":" .. file } })
end,
jj_gvsplit = function(picker, item)
picker:close()
vim.cmd('Gvsplit ' .. vim.fn.fnameescape(item.commit .. ':' .. file))
vim.cmd({ cmd = "Jvsplit", args = { item.change_id .. ":" .. file } })
end,
},
})
@@ -300,13 +299,11 @@ Snacks.picker.jj_show = function(spec)
end,
jj_gsplit = function(picker, item)
picker:close()
local commit = vim.trim(vim.fn.system({ "jj", "show", show_ref, "--template", "commit_id", "--no-patch" }))
vim.cmd('Gsplit ' .. vim.fn.fnameescape(commit .. ':' .. item.file))
vim.cmd({ cmd = "Jsplit", args = { show_ref .. ":" .. item.file } })
end,
jj_gvsplit = function(picker, item)
picker:close()
local commit = vim.trim(vim.fn.system({ "jj", "show", show_ref, "--template", "commit_id", "--no-patch" }))
vim.cmd('Gvsplit ' .. vim.fn.fnameescape(commit .. ':' .. item.file))
vim.cmd({ cmd = "Jvsplit", args = { show_ref .. ":" .. item.file } })
end,
},
})
+19
View File
@@ -184,6 +184,25 @@ vim.treesitter.language.register("markdown", "mdx")
vim.cmd.colorscheme("catppuccin")
-- Terminals report their background color asynchronously via OSC 11, often
-- after our UI plugins have already drawn. When the answer arrives, neovim
-- silently flips 'background' and re-sources the colorscheme (mocha <-> latte),
-- which clears every highlight group -- but it does *not* fire ColorScheme or
-- OptionSet, so plugins that rebuild their highlights on those events (lualine,
-- virt-column) get stranded with cleared/stale colors. Fire the missing
-- ColorScheme ourselves so they refresh against the freshly-loaded flavor.
vim.api.nvim_create_autocmd("TermResponse", {
group = vim.api.nvim_create_augroup("bg-detect-colorscheme-refresh", { clear = true }),
callback = function(ev)
local seq = type(ev.data) == "table" and ev.data.sequence or ev.data
if type(seq) == "string" and seq:find("\27]11;", 1, true) then
vim.schedule(function()
vim.api.nvim_exec_autocmds("ColorScheme", { modeline = false })
end)
end
end,
})
if vim.g.have_nerd_font then
vim.diagnostic.config({
signs = {