Skip to content

Commit

Permalink
perf: fix nvim_replace_termcodes being called on every CursorMoved (
Browse files Browse the repository at this point in the history
  • Loading branch information
sandersantema authored Jul 10, 2023
1 parent 2743dd9 commit c4e491a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plugin/cmp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ end)
autocmd.emit('ColorScheme')

if vim.on_key then
local control_c_termcode = vim.api.nvim_replace_termcodes('<C-c>', true, true, true)
vim.on_key(function(keys)
if keys == vim.api.nvim_replace_termcodes('<C-c>', true, true, true) then
if keys == control_c_termcode then
vim.schedule(function()
if not api.is_suitable_mode() then
autocmd.emit('InsertLeave')
Expand All @@ -52,6 +53,7 @@ if vim.on_key then
end, vim.api.nvim_create_namespace('cmp.plugin'))
end


vim.api.nvim_create_user_command('CmpStatus', function()
require('cmp').status()
end, { desc = 'Check status of cmp sources' })
Expand Down

0 comments on commit c4e491a

Please sign in to comment.