diff --git a/lua/code-completion.lua b/lua/code-completion.lua index 50eb5cb..297477f 100644 --- a/lua/code-completion.lua +++ b/lua/code-completion.lua @@ -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, }) diff --git a/lua/plugins.lua b/lua/plugins.lua index c61e9f3..286d830 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -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", + }, } diff --git a/viml/plugconfig.vim b/viml/plugconfig.vim index a494909..d4122d1 100644 --- a/viml/plugconfig.vim +++ b/viml/plugconfig.vim @@ -44,6 +44,8 @@ function! Build() endif endfunction +colorscheme vim-monokai-tasty + nnoremap :call Build() nnoremap :bdelete nnoremap :BufstopFast diff --git a/viml/vanilla.vim b/viml/vanilla.vim index 5dd3530..59c17fa 100644 --- a/viml/vanilla.vim +++ b/viml/vanilla.vim @@ -4,7 +4,7 @@ filetype plugin on syntax on " colorscheme vim-monokai-tasty -colorscheme desert +colorscheme slate " open builtin terminal function OpenTerm()