ibhagwan / fzf-lua

Improved fzf.vim written in lua
GNU Affero General Public License v3.0
2.15k stars 141 forks source link

Cannot override actions.files["ctrl-g"] (actions.toggle_ignore) #996

Closed lbrayner closed 8 months ago

lbrayner commented 8 months ago

Info

fzf-lua configuration ```lua local actions = require("fzf-lua.actions") require("fzf-lua").setup({ -- These override the default tables completely -- no need to set to `false` to disable an action -- delete or modify is sufficient actions = { files = { ["default"] = actions.file_edit_or_qf, ["ctrl-s"] = actions.file_split, ["alt-s"] = actions.file_vsplit, ["ctrl-t"] = actions.file_tabedit, ["alt-q"] = actions.file_sel_to_qf, ["alt-l"] = actions.file_sel_to_ll, }, }, }) ```

Description

By setting actions.files, I expect to "... override the default tables completely", but ctrl-g is still mapped to actions.toggle_ignore.

ibhagwan commented 8 months ago

By setting actions.files, I expect to "... override the default tables completely", but ctrl-g is still mapped to actions.toggle_ignore.

actions.files refers to all pickers that deal with files which also includes grep, etc.

Toggle ignore action is defined specifically for files, so you’d need to override it there, which also makes it easier as you don’t need to define the other actions:

require("fzf-lua").setup({
  files = { actions = { ["ctrl-g"] = false } },
})
ibhagwan commented 8 months ago

Here’s the definition in the defaults and the reason it wasn’t being overridden in your setup, as you can see below it’s configured directly for files (L230): https://github.com/ibhagwan/fzf-lua/blob/2cd8e0c32fcdad48d8d56120c559d15a10affb3f/lua/fzf-lua/defaults.lua#L212-L230

lbrayner commented 8 months ago

Thanks, @ibhagwan, that clears it up!