mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 03:14:55 +02:00
nvim update
This commit is contained in:
parent
8a39a1b88a
commit
5286b45f9d
4 changed files with 41 additions and 126 deletions
|
|
@ -14,10 +14,10 @@
|
|||
"lspkind-nvim": { "branch": "master", "commit": "1735dd5a5054c1fb7feaf8e8658dbab925f4f0cf" },
|
||||
"lualine-lsp-progress": { "branch": "master", "commit": "56842d097245a08d77912edf5f2a69ba29f275d7" },
|
||||
"lualine.nvim": { "branch": "master", "commit": "8b56462bfb746760465264de41b4907310f113ec" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "21d33d69a81f6351e5a5f49078b2e4f0075c8e73" },
|
||||
"mason-lspconfig.nvim": { "branch": "main", "commit": "55716a879568a498fa236593c8119789054a3b8e" },
|
||||
"mason.nvim": { "branch": "main", "commit": "3b5068f0fc565f337d67a2d315d935f574848ee7" },
|
||||
"mini.comment": { "branch": "main", "commit": "a4b7e46deb9ad2feb8902cc5dbf087eced112ee5" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "7f2ebdef3b55374390714ac7c0a7fe6b0dae498a" },
|
||||
"neo-tree.nvim": { "branch": "main", "commit": "230e9383c664061bdf3517c998ed1bf6ed409c59" },
|
||||
"neotest": { "branch": "master", "commit": "4440cc2227894c2ae9b0673a30e6cc6f1836e8c2" },
|
||||
"neotest-go": { "branch": "main", "commit": "6a2f996d89fe4631942e035b1c114544ee045043" },
|
||||
"neotest-phpunit": { "branch": "main", "commit": "2f01e83eedbcf6f0257934b32b5d4fda404a9f11" },
|
||||
|
|
@ -28,11 +28,10 @@
|
|||
"nvim-cmp": { "branch": "main", "commit": "04e0ca376d6abdbfc8b52180f8ea236cbfddf782" },
|
||||
"nvim-dap": { "branch": "master", "commit": "fc880e82059eb21c0fa896be60146e5f17680648" },
|
||||
"nvim-dap-ui": { "branch": "master", "commit": "9720eb5fa2f41988e8770f973cd11b76dd568a5d" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "16295b79410f131c4fa7870c663b4ace6a761fb2" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "7ff51f53b0efb6228df2e8539b51bb2e737b77f3" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "99330586c6e1912c890fc39d19d97571fde660cd" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "488bec03254207b1dd071be8cb1fb78434b6e777" },
|
||||
"nvim-treesitter-textobjects": { "branch": "master", "commit": "b7a0bfa3e93697ca5b61b15df633404bf8f45883" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "75df79feb02d5e0ec114e447453775d4d291ea03" },
|
||||
"onedark.nvim": { "branch": "master", "commit": "1230aaf2a427b2c5b73aba6e4a9a5881d3e69429" },
|
||||
"playground": { "branch": "master", "commit": "ba48c6a62a280eefb7c85725b0915e021a1a0749" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "7011eaae0ac1afe036e30c95cf80200b8dc3f21a" },
|
||||
|
|
|
|||
|
|
@ -88,42 +88,8 @@ return {
|
|||
config = function(_, opts)
|
||||
local cmp = require('cmp')
|
||||
|
||||
-- local has_words_before = function()
|
||||
-- local line, col = unpack(vim.api.nvim_win_get_cursor(0))
|
||||
-- return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil
|
||||
-- end
|
||||
|
||||
-- local moveDown = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_next_item()
|
||||
-- elseif has_words_before() then
|
||||
-- cmp.complete()
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { "i", "s" })
|
||||
--
|
||||
-- local moveUp = cmp.mapping(function(fallback)
|
||||
-- if cmp.visible() then
|
||||
-- cmp.select_prev_item()
|
||||
-- else
|
||||
-- fallback()
|
||||
-- end
|
||||
-- end, { "i", "s" })
|
||||
|
||||
cmp.setup(opts)
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover,
|
||||
{border = 'single'}
|
||||
)
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "single",
|
||||
})
|
||||
|
||||
-- insert () on function completion using autopairs
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
|
|
|
|||
|
|
@ -7,16 +7,34 @@ return {
|
|||
},
|
||||
opts = {
|
||||
mappings = {
|
||||
["<leader>rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" }}
|
||||
["<leader>rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" }},
|
||||
gd = { vim.lsp.buf.definition, { desc = "Goto definition" }}
|
||||
},
|
||||
servers = {
|
||||
phpactor = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
settings = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
}
|
||||
}
|
||||
},
|
||||
gopls = {}
|
||||
gopls = {},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function (_, opts)
|
||||
|
|
@ -27,17 +45,26 @@ return {
|
|||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = false
|
||||
|
||||
vim.lsp.handlers['textDocument/hover'] = vim.lsp.with(
|
||||
vim.lsp.handlers.hover,
|
||||
{border = 'single'}
|
||||
)
|
||||
|
||||
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
|
||||
focusable = true,
|
||||
style = "minimal",
|
||||
border = "single",
|
||||
})
|
||||
|
||||
local on_attach = function(ev)
|
||||
for bind, settings in pairs(opts.mappings) do
|
||||
vim.keymap.set('n', bind, settings[0], vim.tbl_deep_extend("force", settings[1], { buffer = ev.buf }))
|
||||
vim.keymap.set('n', bind, settings[1], vim.tbl_deep_extend("force", settings[2], { buffer = ev.buf }))
|
||||
end
|
||||
|
||||
-- vim.keymap.set('n', '<leader>rs', vim.lsp.buf.rename, { buffer = ev.buf, desc = "Rename symbol" })
|
||||
end
|
||||
|
||||
for name, settings in pairs(opts.servers) do
|
||||
for name, server_opt in pairs(opts.servers) do
|
||||
|
||||
settings = vim.tbl_deep_extend("force", settings, {
|
||||
local settings = vim.tbl_deep_extend("force", server_opt.settings or {}, {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,77 +0,0 @@
|
|||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
config = function()
|
||||
-- Setup Mason to automatically install LSP servers
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({ automatic_installation = true })
|
||||
local lspconfig = require('lspconfig')
|
||||
local capabilities = require('cmp_nvim_lsp').default_capabilities()
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = false
|
||||
|
||||
|
||||
local on_attach = function(ev)
|
||||
vim.keymap.set('n', '<leader>rs', vim.lsp.buf.rename, { buffer = ev.buf, desc = "Rename symbol" })
|
||||
end
|
||||
|
||||
-- php - phpactor
|
||||
lspconfig.phpactor.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities,
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
}
|
||||
})
|
||||
|
||||
-- GO
|
||||
lspconfig.gopls.setup({
|
||||
on_attach = on_attach,
|
||||
capabilities = capabilities
|
||||
})
|
||||
-- Tailwind CSS
|
||||
--require('lspconfig').tailwindcss.setup({ capabilities = capabilities })
|
||||
|
||||
-- Format on save.
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
pattern = '*.go',
|
||||
callback = function()
|
||||
vim.lsp.buf.format { async = false }
|
||||
end
|
||||
})
|
||||
|
||||
-- Typescript
|
||||
lspconfig.tsserver.setup({
|
||||
capabilities = capabilities
|
||||
})
|
||||
|
||||
-- lua
|
||||
lspconfig.lua_ls.setup({
|
||||
on_init = function(client)
|
||||
local path = client.workspace_folders[1].name
|
||||
if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then
|
||||
client.config.settings = vim.tbl_deep_extend('force', client.config.settings, {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
end
|
||||
return true
|
||||
end,
|
||||
capabilities = capabilities
|
||||
})
|
||||
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue