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

Sun, 19 Feb 2023 11:03:32 -0600

author
Meredith Howard <mhoward@roomag.org>
date
Sun, 19 Feb 2023 11:03:32 -0600
changeset 1025
9dfc1a5a52dc
parent 1022
d509e282ae10
child 1033
589244a349f6
permissions
-rw-r--r--

Fix up tig for nvim

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

mercurial