Files
nvim-cmp/lua/cmp/config/default.lua
hrsh7th e867bf233e Experimental: Ghost text (#119)
* Inline suggest experimental

* Fix flicker

* Fix ci fails

* Reduce flicker

* Improve menu functions

* Default false

* README.md

* Add require

* Rename inline_preview to ghost_text
2021-09-03 18:34:10 +09:00

72 lines
1.5 KiB
Lua

local compare = require('cmp.config.compare')
local types = require('cmp.types')
local WIDE_HEIGHT = 40
---@return cmp.ConfigSchema
return function()
return {
completion = {
autocomplete = {
types.cmp.TriggerEvent.TextChanged,
},
completeopt = 'menu,menuone,noselect',
keyword_pattern = [[\%(-\?\d\+\%(\.\d\+\)\?\|\h\w*\%(-\w*\)*\)]],
keyword_length = 1,
get_trigger_characters = function(trigger_characters)
return trigger_characters
end
},
snippet = {
expand = function()
error('snippet engine is not configured.')
end,
},
preselect = types.cmp.PreselectMode.Item,
documentation = {
border = { '', '', '', ' ', '', '', '', ' ' },
winhighlight = 'NormalFloat:CmpDocumentation,FloatBorder:CmpDocumentationBorder',
maxwidth = math.floor((WIDE_HEIGHT * 2) * (vim.o.columns / (WIDE_HEIGHT * 2 * 16 / 9))),
maxheight = math.floor(WIDE_HEIGHT * (WIDE_HEIGHT / vim.o.lines)),
},
confirmation = {
default_behavior = types.cmp.ConfirmBehavior.Insert,
},
sorting = {
priority_weight = 2,
comparators = {
compare.offset,
compare.exact,
compare.score,
compare.kind,
compare.sort_text,
compare.length,
compare.order,
}
},
event = {},
mapping = {},
formatting = {
deprecated = true,
format = function(_, vim_item)
return vim_item
end
},
experimental = {
ghost_text = false,
},
sources = {},
}
end