-
-
Notifications
You must be signed in to change notification settings - Fork 100
feat(fzf): add fzf-lua integration for buffer and file selection#138
feat(fzf): add fzf-lua integration for buffer and file selection#138xeon826 wants to merge 2 commits intonickjvandyke:mainfrom
Conversation
|
Neat, thank you! I have thought about something like this. I think it'd be more powerful and reusable the way sidekick.nvim does it. Is that possible in fzf-lua? That could get us started on supporting other pickers too. |
|
I created another branch using my fork that more resembles the functionality you're referring to but it seems opencode is lacking an endpoint for submitting file paths so I created an issue and rough draft branch of opencode for adding that. |
|
I think that missing feature is fine for now - it's an optimization, not a requirement. And is consistent with other filepath references anyway. |
Just came up with a neat snacks.picker() action to send context from snacks.picker to opencode, similar to the sidekick.nvim integration: return {
"folke/snacks.nvim", opts = { picker = { actions = { ---@param picker snacks.Picker opencode_send = function(picker) local context = {} for _, item in ipairs(picker:selected { fallback = true }) do local entry = "" -- Build file reference with optional line range if item.file then entry = "@" .. item.file if item.pos then local has_range = item.end_pos and item.end_pos[1] ~= item.pos[1] entry = entry .. (" L%d"):format(item.pos[1]) if has_range then entry = entry .. ("-L%d"):format(item.end_pos[1]) end end end -- Append text content if item.text and item.text ~= "" then entry = entry .. (item.file and "\n " or "") .. item.text end context[#context + 1] = entry end require("opencode").prompt(table.concat(context, "\n") .. "\n") end, }, win = { input = { keys = { [" "opencode_send", mode = { "n", "i" }, }, }, }, }, }, }, } Press Alt+A on current item/selected items in snacks.picker to send context to opencode. Not sure if fzf-lua supports actions like snacks.picker, but I think picker integrations can be handled on the picker-side like this instead of plugin-side. |
|
Nice @naowalrahman! Could you PR that action function? Maybe to |
de5f1cc to
5de2380
Compare
66f04d7 to
a4dff90
Compare