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

Mon, 13 Feb 2023 02:20:08 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Mon, 13 Feb 2023 02:20:08 -0600
changeset 1015
21950cadff6b
parent 1014
b57969db48db
child 1019
7e42fd320166
permissions
-rw-r--r--

Ongoing nvim config

1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
1 return {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
2 "neovim/nvim-lspconfig",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
3 {"williamboman/mason.nvim", config = true},
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
4 {"j-hui/fidget.nvim", config = true},
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
5
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
6 {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
7 "williamboman/mason-lspconfig.nvim",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
8 config = function(plugin, opts)
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
9 require("mason-lspconfig").setup_handlers({
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
10 function(server)
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
11 require("lspconfig")[server].setup({})
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
12 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
13 })
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
14 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
15 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
16
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
17 {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
18 "hrsh7th/nvim-cmp",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
19 event = "InsertEnter",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
20 dependencies = {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
21 "hrsh7th/cmp-buffer",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
22 "hrsh7th/cmp-path",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
23 "hrsh7th/cmp-nvim-lsp",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
24 "hrsh7th/cmp-nvim-lsp-signature-help",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
25 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
26 opts = function()
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
27 local cmp = require("cmp")
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
28 return {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
29 completion = {
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
30 completeopt = "menu,menuone,noinsert,noselect",
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
31 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
32 mapping = cmp.mapping.preset.insert({
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
33 ["<C-b>"] = cmp.mapping.scroll_docs(-4),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
34 ["<C-f>"] = cmp.mapping.scroll_docs(4),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
35 ["<Tab>"] = cmp.mapping.select_next_item(),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
36 ["<S-Tab>"] = cmp.mapping.select_prev_item(),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
37 ["<C-g>"] = cmp.mapping.abort(),
1015
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
38 -- FIXME: add extra space after in select case?
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
39 ["<Space>"] = cmp.mapping.confirm({select = false}),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
40 ["<Right>"] = cmp.mapping.confirm({select = true}),
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
41 }),
1015
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
42 sources = cmp.config.sources({
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
43 { name = "nvim_lsp" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
44 { name = "nvim_lsp_signature_help" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
45 { name = "buffer" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
46 { name = "path" },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
47 }),
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
48 experimental = {
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
49 ghost_text = {
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
50 hl_group = "LspCodeLens",
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
51 },
21950cadff6b Ongoing nvim config
Meredith Howard <mhoward@roomag.org>
parents: 1014
diff changeset
52 },
1014
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
53 }
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
54 end,
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
55 },
b57969db48db start nvim config
Meredith Howard <mhoward@roomag.org>
parents:
diff changeset
56 }

mercurial