diff --git a/nvim/lua/jj-snacks.lua b/nvim/lua/jj-snacks.lua index c4b3432..26448b1 100644 --- a/nvim/lua/jj-snacks.lua +++ b/nvim/lua/jj-snacks.lua @@ -11,9 +11,13 @@ local function jj_cwd(opts, ctx) return cwd end -Snacks.picker.jj_log = function() +Snacks.picker.jj_log = function(file) + local title = "jj log" + if file then + title = "jj log file" + end Snacks.picker.pick({ - title = 'jj log', + title = title, supports_live = false, finder = function(opts, ctx) local cwd = jj_cwd(opts, ctx) @@ -45,6 +49,9 @@ Snacks.picker.jj_log = function() if opts.reversed then table.insert(args, '--reversed') end + if file then + table.insert(args, file) + end vim.list_extend(args, opts.args or {}) return require('snacks.picker.source.proc').proc( ctx:opts({ @@ -115,6 +122,10 @@ Snacks.picker.jj_log = function() }) end +Snacks.picker.jj_log_file = function() + Snacks.picker.jj_log(vim.fn.expand("%:p")) +end + Snacks.picker.jj_show = function(ref) local title = "jj status" if ref ~= nil and ref ~= "@" then diff --git a/nvim/lua/plugins/snacks.lua b/nvim/lua/plugins/snacks.lua index 92627ad..e5f815a 100644 --- a/nvim/lua/plugins/snacks.lua +++ b/nvim/lua/plugins/snacks.lua @@ -283,6 +283,7 @@ return { vim.keymap.set("n", "jl", Snacks.picker.jj_log, { desc = "jj log" }) + vim.keymap.set("n", "jh", Snacks.picker.jj_log_file, { desc = "jj log" }) vim.keymap.set("n", "js", Snacks.picker.jj_show, { desc = "jj status" }) end, },