summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/plugins/lsp.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/plugins/lsp.lua')
-rw-r--r--.config/nvim/lua/plugins/lsp.lua60
1 files changed, 60 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua
new file mode 100644
index 0000000..ad6f420
--- /dev/null
+++ b/.config/nvim/lua/plugins/lsp.lua
@@ -0,0 +1,60 @@
+return {
+ {
+ "williamboman/mason.nvim",
+ config = function()
+ require("mason").setup()
+ end
+ },
+
+ {
+ "williamboman/mason-lspconfig.nvim",
+ config = function()
+ require("mason-lspconfig").setup({
+ -- Add languages
+ ensure_installed = {
+ "bashls",
+ "clangd",
+ "lua_ls",
+ "marksman",
+ "pyright",
+ "rust_analyzer",
+ }
+ })
+ end
+ },
+
+ {
+ "neovim/nvim-lspconfig",
+ config = function()
+ local lspconfig = require("lspconfig")
+ lspconfig.bashls.setup({})
+ lspconfig.lua_ls.setup({})
+ lspconfig.clangd.setup({})
+ lspconfig.marksman.setup({})
+ lspconfig.pyright.setup({})
+ lspconfig.rust_analyzer.setup({})
+
+ -- Key mapping
+ -- Hover for definition
+ vim.keymap.set('n', 'K', vim.lsp.buf.hover, {})
+
+ -- Move to definition
+ vim.api.nvim_create_user_command(
+ "Goto",
+ function()
+ vim.lsp.buf.definition()
+ end,
+ {}
+ )
+
+ -- Code action
+ vim.api.nvim_create_user_command(
+ "Codeact",
+ function()
+ vim.lsp.buf.code_action()
+ end,
+ {}
+ )
+ end
+ }
+}