deleted the cmp-tabnine
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
-- completions.lua: Provides intelligent code completion via LSP or snippet engines.
|
-- completions.lua: Provides intelligent code completion via LSP or snippet engines.
|
||||||
|
-- completion.lua (nvim-cmp + LuaSnip)
|
||||||
-- completion.lua (nvim-cmp + LuaSnip + TabNine – no unzip required)
|
|
||||||
return {
|
return {
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
-- 1. Snippet engine & pre-made snippets
|
-- 1. Snippet engine & pre-made snippets
|
||||||
@@ -9,11 +8,10 @@ return {
|
|||||||
"L3MON4D3/LuaSnip",
|
"L3MON4D3/LuaSnip",
|
||||||
version = "v2.*",
|
version = "v2.*",
|
||||||
build = "make install_jsregexp",
|
build = "make install_jsregexp",
|
||||||
dependencies = { "rafamadriz/friendly-snippets" }
|
dependencies = { "rafamadriz/friendly-snippets" },
|
||||||
},
|
},
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
-- 2. Core completion engine + all standard sources
|
-- 2. Core completion engine + standard sources
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
"hrsh7th/nvim-cmp",
|
"hrsh7th/nvim-cmp",
|
||||||
@@ -23,55 +21,17 @@ return {
|
|||||||
"hrsh7th/cmp-path",
|
"hrsh7th/cmp-path",
|
||||||
"hrsh7th/cmp-cmdline",
|
"hrsh7th/cmp-cmdline",
|
||||||
"hrsh7th/cmp-nvim-lua",
|
"hrsh7th/cmp-nvim-lua",
|
||||||
|
|
||||||
------------------------------------------------------------------
|
|
||||||
-- 3. TabNine (AI) source – install without unzip
|
|
||||||
------------------------------------------------------------------
|
|
||||||
{
|
|
||||||
"tzachar/cmp-tabnine",
|
|
||||||
-- download & unpack with curl + tar (gzip) only
|
|
||||||
build = function()
|
|
||||||
local api = vim.fn
|
|
||||||
local version = api.systemlist('curl -sS https://update.tabnine.com/bundles/version')[1]
|
|
||||||
local platform = (function()
|
|
||||||
local os = api.substitute(api.system('uname -s'), '\n', '', '')
|
|
||||||
local arch = api.substitute(api.system('uname -m'), '\n', '', '')
|
|
||||||
return arch ..
|
|
||||||
'-unknown-' .. (os == 'Linux' and 'linux-musl' or os == 'Darwin' and 'apple-darwin' or 'linux-musl')
|
|
||||||
end)()
|
|
||||||
local root = api.stdpath('data') .. '/lazy/cmp-tabnine'
|
|
||||||
local target = root .. '/binaries/' .. version .. '/' .. platform
|
|
||||||
api.mkdir(target, 'p')
|
|
||||||
api.system(string.format(
|
|
||||||
'curl -L https://update.tabnine.com/bundles/%s/%s/TabNine.zip | gzip -dc | tar -C %s -xf -',
|
|
||||||
version, platform, target))
|
|
||||||
api.system('chmod +x ' .. target .. '/TabNine')
|
|
||||||
vim.g.cmp_tabnine_binary = target .. '/TabNine'
|
|
||||||
end,
|
|
||||||
opts = {
|
|
||||||
max_lines = 1000,
|
|
||||||
max_num_results = 20,
|
|
||||||
sort = true,
|
|
||||||
run_on_every_keystroke = true,
|
|
||||||
show_prediction_strength = false,
|
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
|
||||||
require('cmp_tabnine.config'):setup(opts)
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
-- 4. nvim-cmp setup
|
-- 3. nvim-cmp setup
|
||||||
------------------------------------------------------------------
|
------------------------------------------------------------------
|
||||||
config = function()
|
config = function()
|
||||||
local cmp = require('cmp')
|
local cmp = require("cmp")
|
||||||
require('luasnip.loaders.from_vscode').lazy_load()
|
require("luasnip.loaders.from_vscode").lazy_load()
|
||||||
|
|
||||||
cmp.setup({
|
cmp.setup({
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
require('luasnip').lsp_expand(args.body)
|
require("luasnip").lsp_expand(args.body)
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
window = {
|
window = {
|
||||||
@@ -79,33 +39,25 @@ return {
|
|||||||
documentation = cmp.config.window.bordered(),
|
documentation = cmp.config.window.bordered(),
|
||||||
},
|
},
|
||||||
mapping = cmp.mapping.preset.insert({
|
mapping = cmp.mapping.preset.insert({
|
||||||
['<Tab>'] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
["<Tab>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
['<S-Tab>'] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
["<S-Tab>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
['<C-e>'] = cmp.mapping.abort(),
|
["<C-e>"] = cmp.mapping.abort(),
|
||||||
['<C-b>'] = cmp.mapping.scroll_docs(-4),
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
['<C-f>'] = cmp.mapping.scroll_docs(4),
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
}),
|
}),
|
||||||
sources = cmp.config.sources({
|
sources = cmp.config.sources({
|
||||||
{ name = 'cmp_tabnine', priority = 100 },
|
{ name = "nvim_lsp" },
|
||||||
{ name = 'nvim_lsp' },
|
{ name = "luasnip" },
|
||||||
{ name = 'luasnip' },
|
{ name = "nvim_lua" },
|
||||||
{ name = 'nvim_lua' },
|
|
||||||
}, {
|
}, {
|
||||||
{ name = 'buffer' },
|
{ name = "buffer" },
|
||||||
{ name = 'path' },
|
{ name = "path" },
|
||||||
}),
|
}),
|
||||||
formatting = {
|
|
||||||
format = function(entry, item)
|
|
||||||
if entry.source.name == 'cmp_tabnine' then item.menu = '' end
|
|
||||||
return item
|
|
||||||
end,
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
|
|
||||||
-- cmd-line completion
|
-- cmd-line completion
|
||||||
cmp.setup.cmdline({ '/', '?' }, { sources = { { name = 'buffer' } } })
|
cmp.setup.cmdline({ "/", "?" }, { sources = { { name = "buffer" } } })
|
||||||
cmp.setup.cmdline(':', { sources = cmp.config.sources({ { name = 'path' } }, { { name = 'cmdline' } }) })
|
cmp.setup.cmdline(":", { sources = cmp.config.sources({ { name = "path" } }, { { name = "cmdline" } }) })
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user