return { { 'hrsh7th/nvim-cmp', dependencies = { 'nvim-lua/popup.nvim', 'nvim-lua/plenary.nvim', 'saadparwaiz1/cmp_luasnip', "hrsh7th/cmp-emoji", 'hrsh7th/cmp-nvim-lsp', 'hrsh7th/cmp-buffer', 'hrsh7th/cmp-path', 'hrsh7th/vim-vsnip', 'octaltree/cmp-look', 'folke/trouble.nvim', { 'L3MON4D3/LuaSnip', config = function() vim.keymap.set( {"i", "s"}, "", function() require('luasnip').jump(1) end, {silent = true} ) vim.keymap.set( {"i", "s"}, "", function() require('luasnip').jump(-1) end, {silent = true} ) end, }, }, config = function() require('trouble').setup() local cmp = require'cmp' cmp.setup({ snippet = { -- REQUIRED - you must specify a snippet engine expand = function(args) require('luasnip').lsp_expand(args.body) -- For `luasnip` users. -- vim.snippet.expand(args.body) -- For native neovim snippets (Neovim v0.10+) end, }, window = { completion = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(), }, mapping = cmp.mapping.preset.insert({ [''] = cmp.mapping.scroll_docs(-4), [''] = cmp.mapping.scroll_docs(4), [''] = cmp.mapping.complete(), [''] = cmp.mapping.abort(), [''] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items. }), sources = cmp.config.sources({ { name = 'nvim_lsp' }, { name = 'luasnip' }, -- For luasnip users. }, { { name = 'buffer' }, }) }) end }, { 'neovim/nvim-lspconfig', dependencies = { { "folke/neodev.nvim" } }, config = function() -- Set up lspconfig. local keymap = vim.keymap local on_attach = function(client, bufnr) local opts = { noremap = true, silent = true, buffer = bufnr } keymap.set("n", "gf", "Lspsaga lsp_finder", opts) -- show definition, references keymap.set("n", "gD", "Lspsaga goto_definition", opts) -- got to declaration keymap.set("n", "gd", "Lspsaga peek_definition", opts) -- see definition and make edits in window keymap.set("n", "gi", "lua vim.lsp.buf.implementation()", opts) -- go to implementation keymap.set("n", "ca", "Lspsaga code_action", opts) -- see available code actions keymap.set("n", "rn", "Lspsaga rename", opts) -- smart rename keymap.set("n", "D", "Lspsaga show_line_diagnostics", opts) -- show diagnostics for line keymap.set("n", "d", "Lspsaga show_cursor_diagnostics", opts) -- show diagnostics for cursor keymap.set("n", "[d", "Lspsaga diagnostic_jump_prev", opts) -- jump to previous diagnostic in buffer keymap.set("n", "]d", "Lspsaga diagnostic_jump_next", opts) -- jump to next diagnostic in buffer keymap.set("n", "K", "Lspsaga hover_doc", opts) -- show documentation for what is under cursor keymap.set("n", "o", "LSoutlineToggle", opts) -- see outline on right hand side keymap.set("n", "gr", "lua vim.lsp.buf.references()", opts) vim.keymap.set("n", "", ":cnext") vim.keymap.set("n", "", ":cprev") end local capabilities = require("cmp_nvim_lsp").default_capabilities() -- # Language Servers -- https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md for _,server in ipairs({ 'bitbake_language_server', "clangd", -- C/C++ | clang "ts_ls", -- javascript | typescript-language-server "lua_ls", -- lua (but not init.lua entirely, hence why neodev) "jdtls", "html", "cssls", -- ccs | vscode-css-languageserver "rust_analyzer", -- rust | rust-analyzer "eslint", -- javascript | eslint 'vimls', -- vimscript | vim-language-server 'html', -- html 'jsonls', -- jsonls "pyright", -- python "bashls", -- bash | bash-language-server "gopls", "emmet_ls", "marksman"}) do require("lspconfig")[server].setup({ capabilities = capabilities, on_attach = on_attach }) end -- # specialized config for some LSPs which have non-ideal defaults -- -- require('lspconfig')['java_language_server'].setup{ cmd = { "/usr/share/java/java-language-server/lang_server_linux.sh" }, root_dir = function () return vim.fn.getcwd() end } -- configure html server require('lspconfig')["html"].setup({ init_options = { configurationSection = { "html", "css", "javascript" }, embeddedLanguages = { css = true, javascript = true, }, provideFormatter = true, }, }) require('lspconfig')['pylsp'].setup{ settings = { pylsp = { plugins = { pycodestyle = { ignore = {'W391'}, maxLineLength = 100 } } } } } require("lspconfig").clangd.setup { on_attach = on_attach, capabilities = capabilities, cmd = { "clangd", "--offset-encoding=utf-16", }, } end } }