Handle InsertEnter and CmdlineEnter seperately
This commit is contained in:
@@ -277,6 +277,23 @@ autocmd.subscribe('InsertEnter', function()
|
|||||||
end)
|
end)
|
||||||
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()
|
autocmd.subscribe('TextChanged', function()
|
||||||
if config.enabled() then
|
if config.enabled() then
|
||||||
cmp.core:on_change('TextChanged')
|
cmp.core:on_change('TextChanged')
|
||||||
@@ -289,11 +306,6 @@ autocmd.subscribe('CursorMoved', function()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
autocmd.subscribe('InsertLeave', function()
|
|
||||||
cmp.core:reset()
|
|
||||||
cmp.core.view:close()
|
|
||||||
end)
|
|
||||||
|
|
||||||
cmp.event:on('confirm_done', function(e)
|
cmp.event:on('confirm_done', function(e)
|
||||||
cmp.config.compare.recently_used:add_entry(e)
|
cmp.config.compare.recently_used:add_entry(e)
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ misc.set(_G, { 'cmp', 'plugin', 'cmdline', 'enter' }, function()
|
|||||||
autocmd CmdlineChanged * lua require'cmp.utils.autocmd'.emit('TextChanged')
|
autocmd CmdlineChanged * lua require'cmp.utils.autocmd'.emit('TextChanged')
|
||||||
augroup END
|
augroup END
|
||||||
]]
|
]]
|
||||||
require('cmp.utils.autocmd').emit('InsertEnter')
|
require('cmp.utils.autocmd').emit('CmdlineEnter')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -53,7 +53,7 @@ misc.set(_G, { 'cmp', 'plugin', 'cmdline', 'leave' }, function()
|
|||||||
autocmd!
|
autocmd!
|
||||||
augroup END
|
augroup END
|
||||||
]]
|
]]
|
||||||
require('cmp.utils.autocmd').emit('InsertLeave')
|
require('cmp.utils.autocmd').emit('CmdlineLeave')
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user