Improve macro & dot-repeat support (#363)

* 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

* Remove cmdline features
This commit is contained in:
hrsh7th
2021-10-16 23:37:32 +09:00
committed by GitHub
parent f0a6cca5b9
commit 0f28030aef
13 changed files with 279 additions and 84 deletions

View File

@@ -84,6 +84,12 @@ end
---Select next item if possible
cmp.select_next_item = function(option)
option = option or {}
-- Hack: Ignore when executing macro.
if vim.fn.reg_executing() ~= '' then
return true
end
if cmp.core.view:visible() then
local release = cmp.core:suspend()
cmp.core.view:select_next_item(option)
@@ -103,6 +109,12 @@ end
---Select prev item if possible
cmp.select_prev_item = function(option)
option = option or {}
-- Hack: Ignore when executing macro.
if vim.fn.reg_executing() ~= '' then
return true
end
if cmp.core.view:visible() then
local release = cmp.core:suspend()
cmp.core.view:select_prev_item(option)
@@ -133,6 +145,11 @@ end
cmp.confirm = function(option)
option = option or {}
-- Hack: Ignore when executing macro.
if vim.fn.reg_executing() ~= '' then
return true
end
local e = cmp.core.view:get_selected_entry() or (option.select and cmp.core.view:get_first_entry() or nil)
if e then
cmp.core:confirm(e, {