Skip to content

Commit

Permalink
Merge pull request #30 from julienvincent/fix-mapping-skip
Browse files Browse the repository at this point in the history
Don't use return in a loop
  • Loading branch information
julienvincent authored Sep 11, 2023
2 parents b68207e + adbb93d commit 8dfc802
Showing 1 changed file with 16 additions and 18 deletions.
34 changes: 16 additions & 18 deletions lua/nvim-paredit/utils/keybindings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,25 @@ end

function M.setup_keybindings(opts)
for keymap, action in pairs(opts.keys) do
if not action then
return
end
if action then
local repeatable = true
if type(action.repeatable) == "boolean" then
repeatable = action.repeatable
end

local repeatable = true
if type(action.repeatable) == "boolean" then
repeatable = action.repeatable
end
local fn = action[1]
if repeatable then
fn = M.with_repeat(fn)
end

local fn = action[1]
if repeatable then
fn = M.with_repeat(fn)
vim.keymap.set(action.mode or { "n", "x" }, keymap, fn, {
desc = action[2],
buffer = opts.buf or 0,
expr = repeatable,
remap = false,
silent = true,
})
end

vim.keymap.set(action.mode or { "n", "x" }, keymap, fn, {
desc = action[2],
buffer = opts.buf or 0,
expr = repeatable,
remap = false,
silent = true,
})
end
end

Expand Down

0 comments on commit 8dfc802

Please sign in to comment.