fzf-lsp.nvim icon indicating copy to clipboard operation
fzf-lsp.nvim copied to clipboard

call lua function in actions

Open ViRu-ThE-ViRuS opened this issue 2 years ago • 2 comments

I was wondering if its possible to add functionality where we can set a lua function to be called instead of a vim cmd using g.fzf_lsp_actions?

I have a custom qf list populating method in lua, which I use along with fzf.vim and a couple of custom LSP handlers. It would be great if I can get the same behavior with the qflist made by fzf-lsp.

ViRu-ThE-ViRuS avatar Nov 07 '21 23:11 ViRu-ThE-ViRuS

Right now with the current setup is not possible, but it should be easy to add. Let me check if i understand correctly, you want to do something like: viml version

let g:fzf_lsp_action = {
  'ctrl-t': luaeval("my_custom_action_fn")
}

lua version

vim.g.fzf_lsp_action = {
  "ctrl-t" = my_custom_fn,
}

with my_custom_fn be like:

local function my_custom_fn(fzf_lines)  -- fzf_lines is lua table containing all the selected lines
  -- ...
end

Is this what are you looking for?

gfanto avatar Nov 08 '21 08:11 gfanto

yes, this is exactly what im talking about. I think it would be a great addition to this plugin, and allow its users to get more creative with handling the selected entries from FZF.

ViRu-ThE-ViRuS avatar Nov 08 '21 20:11 ViRu-ThE-ViRuS