mirror of
https://gitlab.com/Zaney/zaneyos.git
synced 2025-01-22 12:18:35 +01:00
forgot again to add the actual config file lol
This commit is contained in:
parent
0e993fa790
commit
005d4f617a
43
config/nvim/plugins/lsp.lua
Normal file
43
config/nvim/plugins/lsp.lua
Normal file
@ -0,0 +1,43 @@
|
||||
local on_attach = function(_, bufnr)
|
||||
|
||||
local bufmap = function(keys, func)
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr })
|
||||
end
|
||||
|
||||
bufmap('<leader>r', vim.lsp.buf.rename)
|
||||
bufmap('<leader>a', vim.lsp.buf.code_action)
|
||||
|
||||
bufmap('gd', vim.lsp.buf.definition)
|
||||
bufmap('gD', vim.lsp.buf.declaration)
|
||||
bufmap('gI', vim.lsp.buf.implementation)
|
||||
bufmap('<leader>D', vim.lsp.buf.type_definition)
|
||||
|
||||
bufmap('gr', require('telescope.builtin').lsp_references)
|
||||
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
|
||||
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
|
||||
|
||||
bufmap('K', vim.lsp.buf.hover)
|
||||
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
end, {})
|
||||
end
|
||||
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
|
||||
require('neodev').setup()
|
||||
require('lspconfig').lua_ls.setup {
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
root_dir = function()
|
||||
return vim.loop.cwd()
|
||||
end,
|
||||
cmd = { "lua-lsp" },
|
||||
settings = {
|
||||
Lua = {
|
||||
workspace = { checkThirdParty = false },
|
||||
telemetry = { enable = false },
|
||||
},
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user