nvim-cmp
nvim-cmp copied to clipboard
Announcement: Breaking changes
Use floating window instead of native menu #224
The user must change the configuration as the following.
Change feeding <C-n>
/<C-p>
and vim.fn.pumvisible() ==
check
You should change the configuration.
cmp.setup {
mapping = {
['<Tab>'] = function(fallback)
if vim.fn.pumvisible() == 1 then
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes('<C-n>', true, true, true), true)
else
fallback()
end
end
}
}
↓↓↓
cmp.setup {
mapping = {
['<Tab>'] = function(fallback)
if cmp.visible() then
cmp.select_next_item()
else
fallback()
end
end
}
}
SourceConfig.opts is deprecated https://github.com/hrsh7th/nvim-cmp/pull/561
cmp.setup {
sources = {
{
name = 'buffer',
opts = {
get_bufnrs = function() return { vim.api.nvim_get_current_buf() } end
}
}
}
}
↓↓↓
cmp.setup {
sources = {
{
name = 'buffer',
option = {
get_bufnrs = function() return { vim.api.nvim_get_current_buf() } end
}
}
}
}
The cmp.complete
arguments was changed
cmp.setup {
mapping = {
['<C-x><C-s>'] = cmp.mapping.complete({
sources = {
{ name = 'vsnip' }
}
}),
}
}
↓↓↓
cmp.setup {
mapping = {
['<C-x><C-s>'] = cmp.mapping.complete({
config = {
sources = {
{ name = 'vsnip' }
}
}
}),
}
}
The cmp#ready
autocmd renamed to CmpReady
autocmd User cmp#ready ...
↓↓↓
autocmd User CmpReady ...
Remove experimental.native_menu
and add view.entries = 'native'
instead.
cmp.setup {
...
experimental = {
native_menu = true
}
...
}
↓↓↓
cmp.setup {
...
view = {
entries = 'native'
}
...
}
Remove documentation
and add window.documentation
instead.
cmp.setup {
...
documentation = false,
...
}
↓↓↓
cmp.setup {
...
window = {
documentation = false,
}
...
}
NOTE: I'm planning the window
configuration option will be deprecated. I think it should be merged to view
configuration option.
Remove all default key mappings (workaround is existing)
All key mappings have been removed by https://github.com/hrsh7th/nvim-cmp/commit/93cf84f7deb2bdb640ffbb1d2f8d6d412a7aa558.
If you want to achieve the previous behavior, you can use the built-in helper as below.
cmp.setup {
...
mapping = cmp.mapping.preset.insert({
-- Your configuration here.
})
...
}
cmp.setup.cmdline {
...
mapping = cmp.mapping.preset.cmdline({
-- Your configuration here.
})
...
}
nvim-cmp will only work on nvim v0.7.x or higher.
status: applied
The nvim v0.7.0 contains the Lua version APIs
.
So nvim-cmp will use it and drop supporting the previous version of nvim.
- vim.api.nvim_create_autocmd
- vim.api.nvim_set_hl
- vim.api.nvim_create_user_command
Related
- https://github.com/hrsh7th/nvim-cmp/pull/956
- https://github.com/hrsh7th/nvim-cmp/pull/844
- https://github.com/hrsh7th/nvim-cmp/pull/922
source[n].max_item_count is removed
This is minor breaking change.
The source[n].max_item_count
is now removed.
Now performance.max_view_entries
can be used for performance.