diff --git a/lua/install-plugins.lua b/lua/install-plugins.lua index 8d1b368..3c84c81 100644 --- a/lua/install-plugins.lua +++ b/lua/install-plugins.lua @@ -312,6 +312,14 @@ return require('packer').startup(function(use) require('plugins.rust-tools-nvim') end, } + use { + 'tzachar/cmp-tabnine', + run = './install.sh', + requires = 'hrsh7th/nvim-cmp', + config = function() + require('plugins.cmp-tabnine') + end, + } use 'ziglang/zig.vim' use { 'akinsho/bufferline.nvim', diff --git a/lua/plugins/cmp-tabnine.lua b/lua/plugins/cmp-tabnine.lua new file mode 100644 index 0000000..06e2f44 --- /dev/null +++ b/lua/plugins/cmp-tabnine.lua @@ -0,0 +1,15 @@ +local tabnine = require('cmp_tabnine.config') + +tabnine:setup({ + max_lines = 1000, + max_num_results = 20, + 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 +}) diff --git a/lua/plugins/mason-lspconfig-nvim.lua b/lua/plugins/mason-lspconfig-nvim.lua index 6e9466d..0a0a7b0 100644 --- a/lua/plugins/mason-lspconfig-nvim.lua +++ b/lua/plugins/mason-lspconfig-nvim.lua @@ -1,4 +1,4 @@ require('mason-lspconfig').setup({ - ensure_installed = { 'sumneko_lua', 'rust_analyzer', 'bashls', 'cssls', 'html', 'jsonls', 'marskman', 'sqls', 'taplo'}, + ensure_installed = { 'sumneko_lua', 'rust_analyzer', 'bashls', 'cssls', 'html', 'jsonls', 'sqls', 'taplo'}, automatic_installation = true, }) diff --git a/lua/plugins/nvim-cmp.lua b/lua/plugins/nvim-cmp.lua index b89296b..5893931 100644 --- a/lua/plugins/nvim-cmp.lua +++ b/lua/plugins/nvim-cmp.lua @@ -48,6 +48,11 @@ cmp.setup({ priority = 100, group_index = 1, }, + { + name = 'cmp_tabnine', + priority = 90, + group_index = 2, + }, { name = 'buffer', priority = 80, @@ -105,18 +110,17 @@ cmp.setup.cmdline(':', { }) -- Add additional capabilities supported by nvim-cmp -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) +local capabilities = require('cmp_nvim_lsp').default_capabilities() local lspconfig = require("lspconfig") -- Enable some language servers with the additional completion capabilities offered by nvim-cmp local servers = { 'pyright', 'tsserver', 'html', 'cssls' } for _, lsp in ipairs(servers) do - lspconfig[lsp].setup({ - -- on_attach = my_custom_on_attach, - capabilities = capabilities, - }) + lspconfig[lsp].setup({ + -- on_attach = my_custom_on_attach, + capabilities = capabilities, + }) end return {