snacks.nvim icon indicating copy to clipboard operation
snacks.nvim copied to clipboard

feature: add conflict git status to picker

Open wvffle opened this issue 10 months ago • 4 comments

Did you check the docs?

  • [X] I have read all the snacks.nvim docs

Is your feature request related to a problem? Please describe.

Reading through picker documentation, I saw that conflict git status icon is missing.

In Neotree I could have had files with conflicts marked with an icon and a highlight.

Describe the solution you'd like

Add a conflict git status icon and highlight

Describe alternatives you've considered

none

Additional context

No response

wvffle avatar Mar 08 '25 10:03 wvffle

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Apr 08 '25 02:04 github-actions[bot]

Bad bot.

wvffle avatar Apr 08 '25 07:04 wvffle

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar May 09 '25 02:05 github-actions[bot]

Bad bot.

wvffle avatar May 13 '25 16:05 wvffle

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jun 13 '25 02:06 github-actions[bot]

Very bad bot.

wvffle avatar Jun 13 '25 13:06 wvffle

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 31 '25 02:07 github-actions[bot]

Extremely bad bot.

wvffle avatar Jul 31 '25 10:07 wvffle

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Sep 01 '25 02:09 github-actions[bot]

bad bot.

wvffle avatar Sep 01 '25 10:09 wvffle

This could be added as an explicit alias (I leave this up to @folke), but it's quite easy to filter the items from the git_status picker with the transform picker option.

The items already have a nice item.status member with the status string, it's as simple as filtering for items with conflict status codes. I wrote this snippet that works great for my needs, although there may be cleaner solutions:

-- poor man's set
local confilct_codes = { ["UU"] = 1, ["AA"] = 1, ["DD"] = 1, ["AU"] = 1, ["UA"] = 1, ["UD"] = 1, ["DU"] = 1 }

vim.keymap.set("n", "<leader>gc", function()
    snacks.picker.pick({
        -- not using the git_status picker directly because I don't want the tab-to-stage keymap
        finder = "git_status",
        format = "git_status",
        preview = "git_status",
        transform = function(item)
            return confilct_codes[item.status] == 1
        end,
    })
end, { desc = "pick [g]it [c]onflicts" })

itsfrank avatar Sep 02 '25 16:09 itsfrank

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 03 '25 02:10 github-actions[bot]

bad bot!

wvffle avatar Oct 03 '25 08:10 wvffle