nvim snacks integrate into flash, todo-comments and trouble

This commit is contained in:
Henrik Bakken
2025-04-22 11:18:50 +02:00
parent ef061267d6
commit 603188f36e
+50
View File
@@ -1177,6 +1177,17 @@ local function makespec_trouble()
desc = "Next Trouble/Quickfix Item", desc = "Next Trouble/Quickfix Item",
}, },
}, },
specs = {
"folke/snacks.nvim",
opts = function(_, opts)
return vim.tbl_deep_extend("force", opts or {}, {
picker = {
actions = require("trouble.sources.snacks").actions,
win = { input = { keys = { ["<c-t>"] = { "trouble_open", mode = { "n", "i" } } } } },
},
})
end,
},
} }
end end
local function makespec_todocomments() local function makespec_todocomments()
@@ -1217,6 +1228,12 @@ local function makespec_todocomments()
"<cmd>Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}<cr>", "<cmd>Trouble todo toggle filter = {tag = {TODO,FIX,FIXME}}<cr>",
desc = "Todo/Fix/Fixme list", desc = "Todo/Fix/Fixme list",
}, },
{ "<leader>st", function() Snacks.picker.todo_comments() end, desc = "Todo" },
{
"<leader>sT",
function() Snacks.picker.todo_comments({ keywords = { "TODO", "FIX", "FIXME" } }) end,
desc = "Todo/Fix/Fixme",
},
}, },
} }
end end
@@ -1292,6 +1309,39 @@ local function makespec_flash()
{ "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" }, { "R", mode = { "o", "x" }, function() require("flash").treesitter_search() end, desc = "Treesitter Search" },
{ "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" }, { "<c-s>", mode = { "c" }, function() require("flash").toggle() end, desc = "Toggle Flash Search" },
}, },
specs = {
{
"folke/snacks.nvim",
opts = {
picker = {
win = {
input = { keys = { ["<a-s>"] = { "flash", mode = { "n", "i" } }, ["s"] = { "flash" } } },
},
actions = {
flash = function(picker)
require("flash").jump({
pattern = "^",
label = { after = { 0, 0 } },
search = {
mode = "search",
exclude = {
function(win)
return vim.bo[vim.api.nvim_win_get_buf(win)].filetype
~= "snacks_picker_list"
end,
},
},
action = function(match)
local idx = picker.list:row2idx(match.pos[1])
picker.list:_move(idx, true, true)
end,
})
end,
},
},
},
},
},
} }
end end