Skip to content

Commit

Permalink
fix: augment attach_mappings without overwriting defaults
Browse files Browse the repository at this point in the history
closes #321
  • Loading branch information
jamestrew committed Nov 5, 2023
1 parent f6ef7d2 commit 5722b9e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lua/telescope/_extensions/file_browser/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ _TelescopeFileBrowserConfig = {
["s"] = fb_actions.toggle_all,
},
},
attach_mappings = function()
attach_mappings = function(_, _)
local entry_is_dir = function()
local entry = action_state.get_selected_entry()
return entry and entry.Path:is_dir()
Expand Down Expand Up @@ -120,6 +120,15 @@ config.setup = function(opts)
-- TODO maybe merge other keys as well from telescope.config
config.values.mappings =
vim.tbl_deep_extend("force", config.values.mappings, require("telescope.config").values.mappings)

if opts.attach_mappings then
local opts_attach = opts.attach_mappings
local default_attach = config.values.attach_mappings
opts.attach_mappings = function(prompt_bufnr, map)
default_attach(prompt_bufnr, map)
return opts_attach(prompt_bufnr, map)
end
end
config.values = vim.tbl_deep_extend("force", config.values, opts)

if config.values.hijack_netrw then
Expand Down

0 comments on commit 5722b9e

Please sign in to comment.