-
Hello, I'm planning to migrate to fzf-lua from telescope and want to use same bindings but from what I've read and experimented I've to define same mappings at multiple places. Following is my config using lazy package manager return {
"ibhagwan/fzf-lua",
dependencies = { "nvim-tree/nvim-web-devicons" },
config = function()
local actions = require("fzf-lua").actions
require("fzf-lua").setup({
"ivy",
defaults = {
git_icons = false,
file_icons = false,
color_icons = false,
},
files = {
actions = {
["enter"] = actions.file_edit,
["ctrl-x"] = actions.file_split,
["ctrl-s"] = actions.file_vsplit,
},
},
buffers = {
show_unloaded = false,
sort_lastused = false,
actions = {
["enter"] = actions.file_edit,
["ctrl-x"] = actions.file_split,
["ctrl-s"] = actions.file_vsplit,
},
},
grep = {
actions = {
["enter"] = actions.file_edit,
["ctrl-x"] = actions.file_split,
["ctrl-s"] = actions.file_vsplit,
},
},
keymap = { -- this keymap is from the `DEFAULT OPTIONS OF THE DIFFERENT CONFIG SECTIONS BELOW` readme section
builtin = { ["<c-o>"] = "toggle-preview" },
fzf = { ["ctrl-q"] = "select-all+accept" },
},
keymaps = { -- this is from the picker sections
actions = { ["ctrl-x"] = actions.keymap_split, ["ctrl-s"] = actions.keymap_vsplit },
},
fzf_opts = { ["--cycle"] = true },
winopts = { preview = { hidden = true, title = false } },
})
end,
}
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
There’s only one keymap table, no “keymaps”, but you’re correct it’s confusing and is on my target list to fix one day, the reason is because there are fzf shell keymaps In any event, from what I see in your config this is irrelevant as you’re trying to configure “actions” which is what happens when you select files, if you wish to combine these for all file-like entries (buffers, files, grep, lsp, etc), define your actions at the global level and they’ll apply to all. require("fzf-lua").setup({
"ivy",
defaults = {
git_icons = false,
file_icons = false,
color_icons = false,
},
actions = {
files = {
["enter"] = actions.file_edit,
["ctrl-x"] = actions.file_split,
["ctrl-s"] = actions.file_vsplit,
},
},
… |
Beta Was this translation helpful? Give feedback.
There’s only one keymap table, no “keymaps”, but you’re correct it’s confusing and is on my target list to fix one day, the reason is because there are fzf shell keymaps
keymap.fzf
and neovim keymapskeymap.builtin
which require knowledge how the plugin works behind the scenes.In any event, from what I see in your config this is irrelevant as you’re trying to configure “actions” which is what happens when you select files, if you wish to combine these for all file-like entries (buffers, files, grep, lsp, etc), define your actions at the global level and they’ll apply to all.