mirror of
https://github.com/hrsh7th/nvim-cmp
synced 2024-09-16 20:54:03 +02:00
feat: avoid global variable use (#1813)
This commit is contained in:
parent
04e0ca376d
commit
a1b4ef08c2
1 changed files with 3 additions and 3 deletions
|
@ -24,7 +24,7 @@ feedkeys.call = setmetatable({
|
|||
if callback then
|
||||
local id = misc.id('cmp.utils.feedkeys.call')
|
||||
self.callbacks[id] = callback
|
||||
table.insert(queue, { keymap.t('<Cmd>call v:lua.cmp.utils.feedkeys.call.run(%s)<CR>'):format(id), 'n', true })
|
||||
table.insert(queue, { keymap.t('<Cmd>lua require"cmp.utils.feedkeys".run(%s)<CR>'):format(id), 'n', true })
|
||||
end
|
||||
|
||||
if is_insert then
|
||||
|
@ -42,12 +42,12 @@ feedkeys.call = setmetatable({
|
|||
end
|
||||
end,
|
||||
})
|
||||
misc.set(_G, { 'cmp', 'utils', 'feedkeys', 'call', 'run' }, function(id)
|
||||
feedkeys.run = function(id)
|
||||
if feedkeys.call.callbacks[id] then
|
||||
feedkeys.call.callbacks[id]()
|
||||
feedkeys.call.callbacks[id] = nil
|
||||
end
|
||||
return ''
|
||||
end)
|
||||
end
|
||||
|
||||
return feedkeys
|
||||
|
|
Loading…
Reference in a new issue