Additional code completion sources (tabnine)
This commit is contained in:
parent
b2a762ab4d
commit
ce70d6f9b7
|
@ -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,
|
||||
})
|
||||
|
|
|
@ -63,4 +63,10 @@ return {
|
|||
"quangnguyen30192/cmp-nvim-ultisnips",
|
||||
"mihaifm/bufstop",
|
||||
"https://git.nickr.eu/yannickreiss/nvim-sourcer.git",
|
||||
{ "tzachar/cmp-fuzzy-buffer", requires = { "hrsh7th/nvim-cmp", "tzachar/fuzzy.nvim" } },
|
||||
{
|
||||
"tzachar/cmp-tabnine",
|
||||
build = "./install.sh",
|
||||
dependencies = "hrsh7th/nvim-cmp",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -44,6 +44,8 @@ function! Build()
|
|||
endif
|
||||
endfunction
|
||||
|
||||
colorscheme vim-monokai-tasty
|
||||
|
||||
nnoremap <C-b> :call Build()<CR>
|
||||
nnoremap <M-w> :bdelete<CR>
|
||||
nnoremap <C-y> :BufstopFast<CR>
|
||||
|
|
|
@ -4,7 +4,7 @@ filetype plugin on
|
|||
syntax on
|
||||
|
||||
" colorscheme vim-monokai-tasty
|
||||
colorscheme desert
|
||||
colorscheme slate
|
||||
|
||||
" open builtin terminal
|
||||
function OpenTerm()
|
||||
|
|
Loading…
Reference in New Issue