Skip to content

Commit

Permalink
feat(nvim): loading gpt context using fzf
Browse files Browse the repository at this point in the history
  • Loading branch information
spywhere committed Oct 22, 2024
1 parent 58cf1f5 commit 862c27a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions configs/nvim/lua/plugin/navigation/fzf.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,27 @@ registry.install {
}))
-- fuzzy search buffer content (.buffers is fuzzy search buffer selection)
bindings.map.normal('<leader>f', fuzzy('live_grep'))

if registry.experiment('gpt').on() then
bindings.map.normal('<leader>g', function ()
require('fzf-lua').fzf_exec('find . -maxdepth 1 -type f', {
prompt = "GPT Context> ",
cwd = vim.env.CLIGPT_CONTEXT_STORAGE,
previewer = false,
preview = {
type = "cmd",
fn = function (items)
local file = require('fzf-lua').path.entry_to_file(items[1])
return string.format("CLIGPT_FORCE_COLOR=1 gpt --parse=%s", file.path)
end
},
actions = {
['default'] = function (selected)
print('selected item:', selected[1])
end
}
})
end)
end
end
}

0 comments on commit 862c27a

Please sign in to comment.