-
For example, I would like to first select a directory from How would I go about implementing this? The following snippet does not work as expected. local project_list = {
vim.fn.expand("~")..'/.config',
vim.fn.expand("~")..'/bin',
vim.fn.expand("~")..'/notes'
}
vim.keymap.set('n', '<leader>pp', function()
local fzf = require("fzf-lua")
local choice = fzf.fzf_exec(project_list)
fzf.files({ cwd = choice })
end) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hi @elenapan, what an honor for you to be interested in my project, to this day I still use a color scheme for my terminal from one of your customizations :) As for your question, fzf-lua is async and runs in a lua coroutine so you can’t chain the commands the way you tried, you need to create a custom action, see: fzf.fzf_exec(project_list, {
actions = {
['default'] = {
fn = function(sel, opts)
fzf.files({ cwd = sel[1] })
end,
-- we use `noclose` to reuse the existing floating windows
-- it will work regardless but you’ll see the windows “flash”
noclose = 1,
},
-- anything is possible with some effort and lua
['ctrl-y'] = function(selected, opts)
print("selected item:", selected[1])
end
}
}) I personally use something similar in my config which switches the Code can be found here: |
Beta Was this translation helpful? Give feedback.
Hi @elenapan, what an honor for you to be interested in my project, to this day I still use a color scheme for my terminal from one of your customizations :)
As for your question, fzf-lua is async and runs in a lua coroutine so you can’t chain the commands the way you tried, you need to create a custom action, see:
https://github.com/ibhagwan/fzf-lua/wiki/Advanced#fzf-exec-acts