nvim: Add jj source to neotree

This commit is contained in:
Marty Oehme 2025-05-09 21:53:53 +02:00
parent b1f751a82d
commit 2bdfb291ae
Signed by: Marty
GPG key ID: 4E535BC19C61886E
3 changed files with 58 additions and 14 deletions

View file

@ -42,6 +42,7 @@
"mdeval.nvim": { "branch": "master", "commit": "0e1b248db174a9659a9ab16eb8c90ff3aec55264" },
"mini.nvim": { "branch": "main", "commit": "0420076298c4457f200c2de468f65d080597a347" },
"molten-nvim": { "branch": "main", "commit": "a286aa914d9a154bc359131aab788b5a077a5a99" },
"neo-tree-jj.nvim": { "branch": "main", "commit": "c6534930c6f79893e12eafbb722ee23e6a83e80e" },
"neo-tree.nvim": { "branch": "main", "commit": "1ef260eb4f54515fe121a2267b477efb054d108a" },
"neogen": { "branch": "main", "commit": "b2e78708876f4da507839726816010a68e33fec8" },
"neotest": { "branch": "master", "commit": "d66cf4e05a116957f0d3a7755a24291c7d1e1f72" },

View file

@ -1,15 +1,4 @@
return {
{
"julienvincent/hunk.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
{ "nvim-tree/nvim-web-devicons", optional = true },
},
cmd = { "DiffEditor" },
config = function()
require("hunk").setup()
end,
},
{
"akinsho/git-conflict.nvim",
event = { "InsertEnter", "CursorHold", "VeryLazy" },
@ -106,4 +95,17 @@ return {
})
end,
},
-- jj diffing
{
"julienvincent/hunk.nvim",
dependencies = {
"MunifTanjim/nui.nvim",
{ "nvim-tree/nvim-web-devicons", optional = true },
},
cmd = { "DiffEditor" },
config = function()
require("hunk").setup()
end,
},
}

View file

@ -38,13 +38,54 @@ return { -- file/item pickers and managers
})
end,
cmd = "Neotree",
opts = {
source_selector = { winbar = true },
},
opts = function(_, opts)
opts.sources = { "filesystem", "git_status", "buffers" }
opts.source_selector = {
winbar = true,
sources = {
{ source = "filesystem" },
{ source = "git_status" },
},
}
opts.close_if_last_window = true
opts.enable_cursor_hijack = true
end,
keys = {
{ "<leader>se", "<cmd>Neotree toggle left<cr>", desc = "filetree", silent = true },
},
},
{ -- substituting git tree listing with jj listing if in jj repo
dependencies = { "Cretezy/neo-tree-jj.nvim" },
"nvim-neo-tree/neo-tree.nvim",
optional = true,
opts = function(_, opts)
opts.sources = opts.sources or {}
opts.source_selector = opts.source_selector or {}
-- Add jj source as available
table.insert(opts.sources, "jj")
-- If there is a git tab in neo-tree replace it when in jj repo
if require("neo-tree.sources.jj.utils").get_repository_root() then
-- Remove git tab
if opts.source_selector.sources then
for i, source in ipairs(opts.source_selector.sources) do
if source.source == "git_status" then
table.remove(opts.source_selector.sources, i)
break
end
end
else
opts.source_selector.sources = {}
end
-- Add jj tab
table.insert(opts.source_selector.sources, {
display_name = "󰊢 JJ",
source = "jj",
})
end
end,
},
{ "MagicDuck/grug-far.nvim", opts = {}, cmd = "GrugFar" },
{
"ibhagwan/fzf-lua",