Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(fzf): add fzf-lua integration for buffer and file selection#138

Open
xeon826 wants to merge 2 commits intonickjvandyke:mainfrom
xeon826:main
Open

feat(fzf): add fzf-lua integration for buffer and file selection#138
xeon826 wants to merge 2 commits intonickjvandyke:mainfrom
xeon826:main

Conversation

Copy link

xeon826 commented Jan 19, 2026

File picker using fzf-lua to select git files or open buffers to add to the prompt. Use it like so:

vim.keymap.set("t", "", function()
require("opencode").fzf.select_files()
end, opts)
vim.keymap.set("t", "", function()
require("opencode").fzf.select_buffers()
end, opts)

Copy link
Owner

nickjvandyke commented Jan 19, 2026

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.

Copy link
Author

xeon826 commented Jan 20, 2026 *
edited
Loading

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.

nickjvandyke reacted with heart emoji

Copy link
Owner

nickjvandyke commented Jan 20, 2026 *
edited
Loading

I think that missing feature is fine for now - it's an optimization, not a requirement. And is consistent with other filepath references anyway.

Copy link
Contributor

naowalrahman commented Jan 27, 2026

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.

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.

nickjvandyke reacted with heart emoji

Copy link
Owner

nickjvandyke commented Jan 28, 2026

Nice @naowalrahman! Could you PR that action function? Maybe to lua/opencode/integrations/picker/snacks.lua or similar. Then I can add a README bit like sidekick.nvim has.

naowalrahman reacted with thumbs up emoji

naowalrahman mentioned this pull request Jan 29, 2026
nickjvandyke force-pushed the main branch 6 times, most recently from de5f1cc to 5de2380 Compare February 2, 2026 16:31
nickjvandyke force-pushed the main branch from 1811541 to 65ce845 Compare February 15, 2026 17:26
Copy link
Owner

nickjvandyke commented Feb 20, 2026

@xeon826 the snacks.picker integration was merged in #152 if you care to use it as a reference to adapt your fzf-lua integration

nickjvandyke force-pushed the main branch 2 times, most recently from 66f04d7 to a4dff90 Compare February 24, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants