Skip to content

Commit

Permalink
refactor: Separate table for feedkeys into 2 local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
anuvyklack committed Sep 22, 2022
1 parent e12284d commit b8bf9d8
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions lua/keymap-amend.lua
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,22 @@ end
---@return function
local function get_original(map)
return function()
local f = {} -- keys for feeding
local keys, fmode
if map.expr then
if map.callback then
f.keys = map.callback()
keys = map.callback()
else
f.keys = vim.api.nvim_eval(map.rhs)
keys = api.nvim_eval(map.rhs)
end
f.keys = termcodes(f.keys)
f.mode = map.noremap and 'in' or 'im'
elseif map.callback then
map.callback()
return
else
f.keys = map.rhs
keys = map.rhs
end
f.keys = termcodes(f.keys)
f.mode = map.noremap and 'in' or 'im'
vim.api.nvim_feedkeys(f.keys, f.mode, true)
keys = termcodes(keys)
fmode = map.noremap and 'in' or 'im'
api.nvim_feedkeys(keys, fmode, false)
end
end

Expand Down

0 comments on commit b8bf9d8

Please sign in to comment.