Handle InsertEnter and CmdlineEnter seperately

This commit is contained in:
hrsh7th
2021-11-09 15:31:56 +09:00
parent 97e4229be6
commit c7a1b9f7c0
2 changed files with 19 additions and 7 deletions

View File

@@ -277,6 +277,23 @@ autocmd.subscribe('InsertEnter', function()
end)
end)
autocmd.subscribe('InsertLeave', function()
cmp.core:reset()
cmp.core.view:close()
end)
autocmd.subscribe('CmdlineEnter', function()
if config.enabled() then
cmp.core:prepare()
cmp.core:on_change('InsertEnter')
end
end)
autocmd.subscribe('CmdlineLeave', function()
cmp.core:reset()
cmp.core.view:close()
end)
autocmd.subscribe('TextChanged', function()
if config.enabled() then
cmp.core:on_change('TextChanged')
@@ -289,11 +306,6 @@ autocmd.subscribe('CursorMoved', function()
end
end)
autocmd.subscribe('InsertLeave', function()
cmp.core:reset()
cmp.core.view:close()
end)
cmp.event:on('confirm_done', function(e)
cmp.config.compare.recently_used:add_entry(e)
end)