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

@@ -1,5 +1,6 @@
local cache = require('cmp.utils.cache')
local misc = require('cmp.utils.misc')
local api = require('cmp.utils.api')
---@class cmp.Config
---@field public g cmp.ConfigSchema
@@ -33,10 +34,10 @@ end
---@return cmp.ConfigSchema
config.get = function()
local bufnr = vim.api.nvim_get_current_buf()
local global = config.global
local bufnr = vim.api.nvim_get_current_buf()
local buffer = config.buffers[bufnr] or { revision = 1 }
return config.cache:ensure({ 'get', bufnr, global.revision or 0, buffer.revision or 0 }, function()
return config.cache:ensure({ 'get_buffer', bufnr, global.revision or 0, buffer.revision or 0 }, function()
return misc.merge(buffer, global)
end)
end
@@ -47,7 +48,7 @@ config.enabled = function()
if type(enabled) == 'function' then
enabled = enabled()
end
return enabled and misc.is_suitable_mode()
return enabled and api.is_suitable_mode()
end
---Return source config