diff options
author | Zach Berwaldt <zberwaldt@tutamail.com> | 2023-09-25 18:59:27 -0400 |
---|---|---|
committer | Zach Berwaldt <zberwaldt@tutamail.com> | 2023-09-25 18:59:27 -0400 |
commit | 624620c918c4d9590f177290e27f469b4778d63f (patch) | |
tree | 5715f0fd70470bad983a8d134ecadc2f7f0b4aec | |
parent | fb6d08dabb1f500aac84be26fc10185b60a30820 (diff) |
add lsp config
-rw-r--r-- | after/plugin/lsp.lua | 34 | ||||
-rw-r--r-- | lua/zberwaldt/packer.lua | 12 | ||||
-rw-r--r-- | plugin/packer_compiled.lua | 35 |
3 files changed, 81 insertions, 0 deletions
diff --git a/after/plugin/lsp.lua b/after/plugin/lsp.lua new file mode 100644 index 0000000..3e61be0 --- /dev/null +++ b/after/plugin/lsp.lua | |||
@@ -0,0 +1,34 @@ | |||
1 | local lsp = require("lsp-zero") | ||
2 | |||
3 | lsp.preset("recommended") | ||
4 | |||
5 | lsp.on_attach(function(client, bufnr) | ||
6 | local opts = { buffer = bufnr, remap = false } | ||
7 | |||
8 | vim.keymap.set("n", "gd", function () vim.lsp.buf.definition() end, opts) | ||
9 | |||
10 | lsp.default_keymaps({buffer = bufnr}) | ||
11 | end) | ||
12 | |||
13 | require('mason').setup({}) | ||
14 | require('mason-lspconfig').setup({ | ||
15 | -- Replace the language servers listed here | ||
16 | -- with the ones you want to install | ||
17 | ensure_installed = {'tsserver', 'eslint', 'sumneko_lua', 'rust_analyzer'}, | ||
18 | handlers = { | ||
19 | lsp.default_setup, | ||
20 | }, | ||
21 | }) | ||
22 | |||
23 | local cmp = require('cmp') | ||
24 | local cmp_select = {behavior = cmp.SelectBehavior.Select} | ||
25 | local cmp_mappings = lsp.defaults.cmp_mappings({ | ||
26 | ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select), | ||
27 | ['<C-n>'] = cmp.mapping.select_next_item(cmp_select), | ||
28 | ['<C-y>'] = cmp.mapping.confirm({ select = true }), | ||
29 | ["<C-Space>"] = cmp.mapping.complete(), | ||
30 | }) | ||
31 | |||
32 | lsp.set_preferences({ | ||
33 | sign_icons = { } | ||
34 | }) | ||
diff --git a/lua/zberwaldt/packer.lua b/lua/zberwaldt/packer.lua index 030c760..1b9a136 100644 --- a/lua/zberwaldt/packer.lua +++ b/lua/zberwaldt/packer.lua | |||
@@ -21,4 +21,16 @@ return require('packer').startup(function(use) | |||
21 | use('theprimeagen/harpoon') | 21 | use('theprimeagen/harpoon') |
22 | use('mbbill/undotree') | 22 | use('mbbill/undotree') |
23 | use('tpope/vim-fugitive') | 23 | use('tpope/vim-fugitive') |
24 | use { | ||
25 | 'VonHeikemen/lsp-zero.nvim', | ||
26 | branch = 'v3.x', | ||
27 | requires = { | ||
28 | {'williamboman/mason.nvim'}, | ||
29 | {'williamboman/mason-lspconfig.nvim'}, | ||
30 | {'neovim/nvim-lspconfig'}, | ||
31 | {'hrsh7th/nvim-cmp'}, | ||
32 | {'hrsh7th/cmp-nvim-lsp'}, | ||
33 | {'L3MON4D3/LuaSnip'}, | ||
34 | } | ||
35 | } | ||
24 | end) | 36 | end) |
diff --git a/plugin/packer_compiled.lua b/plugin/packer_compiled.lua index 5c9c711..342aaee 100644 --- a/plugin/packer_compiled.lua +++ b/plugin/packer_compiled.lua | |||
@@ -74,11 +74,46 @@ end | |||
74 | time([[try_loadstring definition]], false) | 74 | time([[try_loadstring definition]], false) |
75 | time([[Defining packer_plugins]], true) | 75 | time([[Defining packer_plugins]], true) |
76 | _G.packer_plugins = { | 76 | _G.packer_plugins = { |
77 | LuaSnip = { | ||
78 | loaded = true, | ||
79 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/LuaSnip", | ||
80 | url = "https://github.com/L3MON4D3/LuaSnip" | ||
81 | }, | ||
82 | ["cmp-nvim-lsp"] = { | ||
83 | loaded = true, | ||
84 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp", | ||
85 | url = "https://github.com/hrsh7th/cmp-nvim-lsp" | ||
86 | }, | ||
77 | harpoon = { | 87 | harpoon = { |
78 | loaded = true, | 88 | loaded = true, |
79 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/harpoon", | 89 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/harpoon", |
80 | url = "https://github.com/theprimeagen/harpoon" | 90 | url = "https://github.com/theprimeagen/harpoon" |
81 | }, | 91 | }, |
92 | ["lsp-zero.nvim"] = { | ||
93 | loaded = true, | ||
94 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/lsp-zero.nvim", | ||
95 | url = "https://github.com/VonHeikemen/lsp-zero.nvim" | ||
96 | }, | ||
97 | ["mason-lspconfig.nvim"] = { | ||
98 | loaded = true, | ||
99 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim", | ||
100 | url = "https://github.com/williamboman/mason-lspconfig.nvim" | ||
101 | }, | ||
102 | ["mason.nvim"] = { | ||
103 | loaded = true, | ||
104 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/mason.nvim", | ||
105 | url = "https://github.com/williamboman/mason.nvim" | ||
106 | }, | ||
107 | ["nvim-cmp"] = { | ||
108 | loaded = true, | ||
109 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/nvim-cmp", | ||
110 | url = "https://github.com/hrsh7th/nvim-cmp" | ||
111 | }, | ||
112 | ["nvim-lspconfig"] = { | ||
113 | loaded = true, | ||
114 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", | ||
115 | url = "https://github.com/neovim/nvim-lspconfig" | ||
116 | }, | ||
82 | ["nvim-treesitter"] = { | 117 | ["nvim-treesitter"] = { |
83 | loaded = true, | 118 | loaded = true, |
84 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/nvim-treesitter", | 119 | path = "/home/zberwaldt/.local/share/nvim/site/pack/packer/start/nvim-treesitter", |