RFC: cmdline completion (#362)
* manual support dot-repeat * cmdwin and terminal * cmdline only * Fix * fix * Improve * Fix test * Support macro * disable cmdline for now * Simplify * fmt * consume once * Ignore = type * cmdline * fmt * Improve * update * fmt * Support incsearch * fix * Add api * Avoid cmdline completion if the native_menu enabled * fix for macro * Improve * fmt * Insert-mode only by default * Update * avoid conflict * Improve default mapping * Fix * fix * similar to native * Update * Fix README.md * Improve * Use <afile>
This commit is contained in:
@@ -70,10 +70,6 @@ cmp.close = function()
|
||||
cmp.core:reset()
|
||||
vim.schedule(release)
|
||||
return true
|
||||
elseif vim.fn.pumvisible() == 1 then
|
||||
vim.fn.complete(1, {})
|
||||
cmp.core:reset()
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
@@ -86,14 +82,16 @@ cmp.abort = function()
|
||||
cmp.core.view:abort()
|
||||
vim.schedule(release)
|
||||
return true
|
||||
elseif vim.fn.pumvisible() == 1 then
|
||||
vim.api.nvim_select_popupmenu_item(-1, true, true, {})
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
---Suspend completion.
|
||||
cmp.suspend = function()
|
||||
return cmp.core:suspend()
|
||||
end
|
||||
|
||||
---Select next item if possible
|
||||
cmp.select_next_item = function(option)
|
||||
option = option or {}
|
||||
@@ -252,6 +250,9 @@ cmp.setup = setmetatable({
|
||||
buffer = function(c)
|
||||
config.set_buffer(c, vim.api.nvim_get_current_buf())
|
||||
end,
|
||||
cmdline = function(type, c)
|
||||
config.set_cmdline(c, type)
|
||||
end,
|
||||
}, {
|
||||
__call = function(self, c)
|
||||
self.global(c)
|
||||
|
||||
Reference in New Issue
Block a user