.config/nvim/lua/plugins/lsp.lua

changeset 1014
b57969db48db
child 1015
21950cadff6b
new file mode 100644
--- /dev/null
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -0,0 +1,55 @@
+return {
+  "neovim/nvim-lspconfig",
+  {"williamboman/mason.nvim", config = true},
+  {"j-hui/fidget.nvim", config = true},
+
+  {
+    "williamboman/mason-lspconfig.nvim",
+    config = function(plugin, opts)
+      require("mason-lspconfig").setup_handlers({
+        function(server)
+          require("lspconfig")[server].setup({})
+        end,
+      })
+    end,
+  },
+
+  {
+    "hrsh7th/nvim-cmp",
+    event = "InsertEnter",
+    dependencies = {
+      "hrsh7th/cmp-buffer",
+      "hrsh7th/cmp-path",
+      "hrsh7th/cmp-nvim-lsp",
+      "hrsh7th/cmp-nvim-lsp-signature-help",
+    },
+    opts = function()
+      local cmp = require("cmp")
+      return {
+        completion = {
+          completeopt = "menu,menuone,noinsert,noselect",
+        },
+        mapping = cmp.mapping.preset.insert({
+          ["<C-b>"] = cmp.mapping.scroll_docs(-4),
+          ["<C-f>"] = cmp.mapping.scroll_docs(4),
+          ["<Tab>"] = cmp.mapping.select_next_item(),
+          ["<S-Tab>"] = cmp.mapping.select_prev_item(),
+          ["<C-g>"] = cmp.mapping.abort(),
+          ["<Space>"] = cmp.mapping.confirm({select = false}),
+          ["<Right>"] = cmp.mapping.confirm({select = true}),
+        }),
+	sources = cmp.config.sources({
+	  { name = "nvim_lsp" },
+	  { name = "nvim_lsp_signature_help" },
+	  { name = "buffer" },
+	  { name = "path" },
+	}),
+	experimental = {
+	  ghost_text = {
+	    hl_group = "LspCodeLens",
+	  },
+	},
+      }
+    end,
+  },
+}

mercurial