Dotfiles/.config/nvim/lua/tsv/plugins/lspconfig.lua

35 lines
1.2 KiB
Lua
Raw Normal View History

2024-03-04 14:36:33 +00:00
return {
"neovim/nvim-lspconfig",
2024-03-16 11:36:09 +00:00
dependencies = {
"williamboman/mason.nvim",
"williamboman/mason-lspconfig.nvim",
},
2024-03-04 14:36:33 +00:00
config = function()
2024-03-16 11:36:09 +00:00
require("mason").setup()
require("mason-lspconfig").setup({
automatic_installation = true,
})
require("mason-lspconfig").setup_handlers({
function(server_name)
require("lspconfig")[server_name].setup({})
end,
2024-06-05 17:44:12 +00:00
["ruby_lsp"] = function()
require("lspconfig").ruby_lsp.setup({
cmd = {"/home/tsv/.rbenv/shims/ruby-lsp"},
2024-03-16 11:36:09 +00:00
on_attach = function(client, buffer)
setup_diagnostics(client, buffer)
add_ruby_deps_command(client, buffer)
end,
})
end
})
vim.keymap.set('n', '<leader>ld', function() vim.lsp.buf.definition() end, bufopts)
2024-03-04 14:36:33 +00:00
vim.keymap.set('n', '<leader>la', function() vim.lsp.buf.code_action() end, bufopts)
vim.keymap.set('n', '<leader>lK', vim.lsp.buf.signature_help, {})
vim.keymap.set('n', '<leader>lq', vim.diagnostic.setloclist, {})
vim.keymap.set('n', 'E', vim.diagnostic.open_float, {})
vim.keymap.set('n', 'H', function() vim.lsp.buf.hover() end, opts)
vim.keymap.set("n", "<leader>lf", vim.lsp.buf.format) -- Format code
end
}