Additional code completion sources (tabnine)
This commit is contained in:
@@ -16,10 +16,10 @@ cmp.setup({
|
||||
},
|
||||
|
||||
-- Add borders to the windows
|
||||
-- window = {
|
||||
-- completion = cmp.config.window.bordered(),
|
||||
-- documentation = cmp.config.window.bordered(),
|
||||
-- },
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(),
|
||||
documentation = cmp.config.window.bordered(),
|
||||
},
|
||||
|
||||
-- mapping
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
@@ -53,7 +53,7 @@ cmp.setup({
|
||||
{ name = "buffer", keyword_length = 1 },
|
||||
{ name = "calc" },
|
||||
{ name = "lua-latex-symbols", option = { cache = true } },
|
||||
-- { name = "spell", option = { keep_all_entries = false }, keyword_length = 2 },
|
||||
{ name = "cmp_tabnine", keyword_length = 2 },
|
||||
}),
|
||||
|
||||
-- add formatting of the different sources
|
||||
@@ -69,6 +69,7 @@ cmp.setup({
|
||||
lualatexsymbols = "𝕋",
|
||||
spell = "📚",
|
||||
fuzzy_buffer = "📄",
|
||||
cmp_tabnine = "🖳",
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
@@ -91,6 +92,16 @@ cmp.setup.cmdline({ "/", "?" }, {
|
||||
sources = {
|
||||
{ name = "buffer" },
|
||||
},
|
||||
formatting = {
|
||||
fields = { "menu", "abbr", "kind" },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
buffer = "📚",
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
|
||||
@@ -98,8 +109,37 @@ cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "path" },
|
||||
{ name = "cmdline_history", keyword_length = 15 },
|
||||
{ name = "cmdline_history", keyword_length = 8 },
|
||||
}, {
|
||||
{ name = "cmdline" },
|
||||
}),
|
||||
formatting = {
|
||||
fields = { "menu", "abbr", "kind" },
|
||||
format = function(entry, item)
|
||||
local menu_icon = {
|
||||
path = "🌐",
|
||||
cmdline = "🎛",
|
||||
cmdline_history = "📰",
|
||||
}
|
||||
item.menu = menu_icon[entry.source.name]
|
||||
return item
|
||||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- Tabnine configuration
|
||||
local tabnine = require("cmp_tabnine.config")
|
||||
tabnine:setup({
|
||||
max_lines = 1000,
|
||||
max_num_results = 10,
|
||||
sort = true,
|
||||
run_on_every_keystroke = true,
|
||||
snippet_placeholder = "..",
|
||||
ignored_file_types = {
|
||||
-- default is not to ignore
|
||||
-- uncomment to ignore in lua:
|
||||
-- lua = true
|
||||
},
|
||||
show_prediction_strength = true,
|
||||
min_percent = 40,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user