From 8960267e5e006b018752424465695a193f1596a5 Mon Sep 17 00:00:00 2001 From: m-b-t-n Date: Tue, 28 Jan 2025 14:40:43 +0900 Subject: [PATCH] neovim: Add LSP settings This is based on: https://namileriblog.com/mac/lazy_nvim_lsp/ refs #206 --- neovim/lua/plugins/lsp.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 neovim/lua/plugins/lsp.lua diff --git a/neovim/lua/plugins/lsp.lua b/neovim/lua/plugins/lsp.lua new file mode 100644 index 0000000..c4a5cce --- /dev/null +++ b/neovim/lua/plugins/lsp.lua @@ -0,0 +1,29 @@ +local lsp_servers = { + "bashls", + "lua_ls", +} + +return { + { + "williamboman/mason.nvim", + dependencies = { + "williamboman/mason-lspconfig.nvim", + "neovim/nvim-lspconfig", + }, + config = function() + require("mason").setup() + require("mason-lspconfig").setup({ + ensure_installed = lsp_servers, + }) + local lsp_config = require("lspconfig") + for _, lsp_server in ipairs(lsp_servers) do + lsp_config[lsp_server].setup({ + root_dir = function(fname) + return lsp_config.util.find_git_ancestor(fname) or vim.fn.getcwd() + end, + }) + end + end, + }, +} +