mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 19:30:01 +02:00
nvim: move some config stuff out of plugins directory
This commit is contained in:
parent
325b0856e8
commit
8a876daf74
4 changed files with 148 additions and 145 deletions
|
|
@ -5,68 +5,7 @@ return {
|
|||
'williamboman/mason-lspconfig.nvim',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
opts = {
|
||||
mappings = {
|
||||
["<leader>rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" }},
|
||||
["<leader>ca"] = { vim.lsp.buf.code_action, { desc = "Code action" }},
|
||||
["<leader>ff"] = { vim.lsp.buf.format, { desc = "Format file" }},
|
||||
gd = { vim.lsp.buf.definition, { desc = "Goto definition" }},
|
||||
gi = { vim.lsp.buf.implementation, { desc = "Goto implementation"}},
|
||||
gr = { vim.lsp.buf.references, { desc = "Goto references"}},
|
||||
},
|
||||
servers = {
|
||||
phpactor = {
|
||||
settings = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
}
|
||||
}
|
||||
},
|
||||
gopls = {
|
||||
-- format_on_save = true,
|
||||
on_save = function ()
|
||||
local params = vim.lsp.util.make_range_params()
|
||||
params.context = {only = {"source.organizeImports"}}
|
||||
local result = vim.lsp.buf_request_sync(0, "textDocument/codeAction", params, 1000)
|
||||
for cid, res in pairs(result or {}) do
|
||||
for _, r in pairs(res.result or {}) do
|
||||
if r.edit then
|
||||
local enc = (vim.lsp.get_client_by_id(cid) or {}).offset_encoding or "utf-16"
|
||||
vim.lsp.util.apply_workspace_edit(r.edit, enc)
|
||||
end
|
||||
end
|
||||
end
|
||||
vim.lsp.buf.format({async = false})
|
||||
end,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedwrite = true,
|
||||
useany = true
|
||||
},
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = require('config.plugins.lsp'),
|
||||
config = function (_, opts)
|
||||
-- Setup Mason to automatically install LSP servers
|
||||
require('mason').setup()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue