Skip to content

Commit 72c6315

Browse files
committed
fix: no early return in mapping create
1 parent f1473c6 commit 72c6315

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

lua/search-and-replace/config.lua

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,11 @@ local function register_mappings(options, mappings)
7474

7575
for name, command in pairs(mappings) do
7676
-- this specific mapping is disabled
77-
if not options[name] then
78-
return
79-
end
77+
if options[name] then
78+
assert(type(options[name]) == "string", string.format("`%s` must be a string", name))
8079

81-
assert(type(options[name]) == "string", string.format("`%s` must be a string", name))
82-
vim.api.nvim_set_keymap("n", options[name], command, { silent = true })
83-
vim.api.nvim_set_keymap("v", options[name], command, { silent = true })
80+
vim.keymap.set({ "n", "v" }, options[name], command)
81+
end
8482
end
8583
end
8684

lua/search-and-replace/state.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ function state:create_buffer(scope, cb)
147147
_G.SearchAndReplace.config.default_replace_prompt_to_selection
148148
and self.selection ~= ""
149149
then
150-
vim.api.nvim_buf_set_text(self.buffer, 0, 0, 0, 0, { self.selection })
150+
vim.fn.prompt_setprompt(self.buffer, self.selection)
151+
-- vim.api.nvim_buf_set_text(self.buffer, 0, 0, 0, 0, { self.selection })
151152
end
152153
end,
153154
group = self.augroup_name,

0 commit comments

Comments
 (0)