mirror of
https://github.com/pnx/dotfiles
synced 2026-06-17 03:30:01 +02:00
big nvim update. maybe broke something
This commit is contained in:
parent
1e68462bc1
commit
8a39a1b88a
32 changed files with 531 additions and 195 deletions
133
nvim/lua/plugins/ide/cmp.lua
Normal file
133
nvim/lua/plugins/ide/cmp.lua
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
return {
|
||||
'hrsh7th/nvim-cmp',
|
||||
version = false,
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'onsails/lspkind-nvim',
|
||||
},
|
||||
opts = function()
|
||||
local cmp = require('cmp')
|
||||
vim.api.nvim_set_hl(0, "CmpGhostText", { link = "NonText", default = true })
|
||||
|
||||
local selectPrev = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
local selectNext = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert })
|
||||
|
||||
local border = cmp.config.window.bordered({
|
||||
border = {'┌', '─', '┐', '│', '┘', '─', '└', '│'},
|
||||
winhighlight = 'Normal:None,FloatBorder:FloatBorder,CursorLine:PmenuSel,Search:None'
|
||||
})
|
||||
|
||||
return {
|
||||
completion = {
|
||||
completeopt = "menu,menuone,noinsert",
|
||||
},
|
||||
-- enabled = function()
|
||||
-- if require"cmp.config.context".in_treesitter_capture("comment")==true or require"cmp.config.context".in_syntax_group("Comment") then
|
||||
-- return false
|
||||
-- else
|
||||
-- return true
|
||||
-- end
|
||||
-- end,
|
||||
-- preselect = false,
|
||||
view = {
|
||||
entries = { name = 'custom', selection_order = 'near_cursor' },
|
||||
},
|
||||
window = {
|
||||
documentation = border,
|
||||
completion = border
|
||||
},
|
||||
mapping = {
|
||||
["<Up>"] = selectPrev,
|
||||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
-- ["<esc>"] = close without removeing typed text,
|
||||
["<S-space>"] = cmp.mapping.complete(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
-- formatting = {
|
||||
-- fields = { "abbr", "menu", "kind" },
|
||||
-- format = function(entry, vim_item)
|
||||
-- if vim.tbl_contains({ 'path' }, entry.source.name) then
|
||||
-- local icon, hl_group = require('nvim-web-devicons').get_icon(entry:get_completion_item().label)
|
||||
-- if icon then
|
||||
-- vim_item.kind = icon
|
||||
-- vim_item.kind_hl_group = hl_group
|
||||
-- return vim_item
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- local opts = {
|
||||
-- mode = 'symbol',
|
||||
-- }
|
||||
-- return require('lspkind').cmp_format(opts)(entry, vim_item)
|
||||
-- end
|
||||
-- },
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = 'buffer' },
|
||||
{ name = 'path' },
|
||||
{ name = 'luasnip' }
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = {
|
||||
hl_group = "CmpGhostText",
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
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',
|
||||
require('nvim-autopairs.completion.cmp').on_confirm_done()
|
||||
)
|
||||
end
|
||||
}
|
||||
54
nvim/lua/plugins/ide/dap.lua
Normal file
54
nvim/lua/plugins/ide/dap.lua
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
return {
|
||||
"mfussenegger/nvim-dap",
|
||||
dependencies = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
-- optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>d"] = { name = "+debug" },
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"rcarriga/nvim-dap-ui",
|
||||
-- stylua: ignore
|
||||
keys = {
|
||||
{ "<leader>du", function() require("dapui").toggle({ }) end, desc = "Dap UI" },
|
||||
{ "<leader>de", function() require("dapui").eval() end, desc = "Eval", mode = {"n", "v"} },
|
||||
},
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
-- setup dap config by VsCode launch.json file
|
||||
-- require("dap.ext.vscode").load_launchjs()
|
||||
local dap = require("dap")
|
||||
local dapui = require("dapui")
|
||||
dapui.setup(opts)
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open({})
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close({})
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>dw", function() require("dap.ui.widgets").hover() end, desc = "Widgets" },
|
||||
},
|
||||
config = function()
|
||||
-- local Config = require("lazyvim.config")
|
||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||
|
||||
-- for name, sign in pairs(Config.icons.dap) do
|
||||
-- sign = type(sign) == "table" and sign or { sign }
|
||||
-- vim.fn.sign_define(
|
||||
-- "Dap" .. name,
|
||||
-- { text = sign[1], texthl = sign[2] or "DiagnosticInfo", linehl = sign[3], numhl = sign[3] }
|
||||
-- )
|
||||
-- end
|
||||
end,
|
||||
}
|
||||
17
nvim/lua/plugins/ide/laravel.lua
Normal file
17
nvim/lua/plugins/ide/laravel.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"adalessa/laravel.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"tpope/vim-dotenv",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
},
|
||||
cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" },
|
||||
keys = {
|
||||
{ "<leader>la", ":Laravel artisan<cr>" },
|
||||
{ "<leader>lr", ":Laravel routes<cr>" },
|
||||
{ "<leader>lm", ":Laravel related<cr>" },
|
||||
},
|
||||
event = { "VeryLazy" },
|
||||
config = true,
|
||||
}
|
||||
47
nvim/lua/plugins/ide/lsp.lua
Normal file
47
nvim/lua/plugins/ide/lsp.lua
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
},
|
||||
opts = {
|
||||
mappings = {
|
||||
["<leader>rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" }}
|
||||
},
|
||||
servers = {
|
||||
phpactor = {
|
||||
init_options = {
|
||||
["language_server_phpstan.enabled"] = true,
|
||||
["language_server_psalm.enabled"] = false,
|
||||
}
|
||||
},
|
||||
gopls = {}
|
||||
},
|
||||
},
|
||||
config = function (_, opts)
|
||||
-- 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)
|
||||
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 }))
|
||||
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
|
||||
|
||||
settings = vim.tbl_deep_extend("force", settings, {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach
|
||||
})
|
||||
lspconfig[name].setup(settings)
|
||||
end
|
||||
end
|
||||
}
|
||||
54
nvim/lua/plugins/ide/neotest.lua
Normal file
54
nvim/lua/plugins/ide/neotest.lua
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
return {
|
||||
"nvim-neotest/neotest",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"antoinemadec/FixCursorHold.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
"nvim-neotest/neotest-go",
|
||||
"olimorris/neotest-phpunit",
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>t"] = { name = "+test" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{"<leader>tn", ":lua require('neotest').run.run()<cr>", desc = "test nearest", silent = true},
|
||||
{"<leader>tf", ":lua require('neotest').run.run(vim.fn.expand('%'))<cr>", desc = "test file"},
|
||||
{"<leader>ta", ":lua require('neotest').output_panel.open()<cr>:lua require('neotest').run.run({suite = true})<cr>", desc = "test all"},
|
||||
{"<leader>ts", ":lua require('neotest').run.stop()<cr>", desc = "stop test"},
|
||||
{"<leader>tq", ":lua require('neotest').output_panel.close()<cr>", desc = "close output window"},
|
||||
{"<leader>te", ":lua require('neotest').summary()<cr>"}
|
||||
},
|
||||
opts = function()
|
||||
local icons = require('config.icons').test
|
||||
|
||||
return {
|
||||
adapters = {
|
||||
require("neotest-go")({
|
||||
recursive_run = true
|
||||
}),
|
||||
require("neotest-phpunit")
|
||||
},
|
||||
icons = {
|
||||
child_indent = "│",
|
||||
child_prefix = "├",
|
||||
collapsed = "─",
|
||||
expanded = "┐",
|
||||
failed = icons.failed,
|
||||
final_child_indent = " ",
|
||||
final_child_prefix = "└",
|
||||
non_collapsible = "─",
|
||||
passed = icons.ok,
|
||||
running = icons.running,
|
||||
skipped = icons.skipped,
|
||||
unknown = icons.unknown,
|
||||
watching = icons.watch
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
80
nvim/lua/plugins/ide/treesitter.lua
Normal file
80
nvim/lua/plugins/ide/treesitter.lua
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
return {
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = function()
|
||||
require('nvim-treesitter.install').update({ with_sync = true })
|
||||
end,
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
'nvim-treesitter/playground'
|
||||
},
|
||||
opts = {
|
||||
-- A list of parser names
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"c",
|
||||
"cpp",
|
||||
"ninja",
|
||||
"cmake",
|
||||
"make",
|
||||
"lua",
|
||||
"vim",
|
||||
"vimdoc",
|
||||
"query",
|
||||
"php",
|
||||
"phpdoc",
|
||||
"blade",
|
||||
"go",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"css",
|
||||
"scss",
|
||||
"html",
|
||||
"vue",
|
||||
"json",
|
||||
"jsonc",
|
||||
"yaml",
|
||||
"toml",
|
||||
"xml",
|
||||
"glsl",
|
||||
"hlsl",
|
||||
"markdown"
|
||||
},
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = true,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = false,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
|
||||
-- Setting this to true will run `:h syntax` and tree-sitter at the same time.
|
||||
-- Set this to `true` if you depend on 'syntax' being enabled (like for indentation).
|
||||
-- Using this option may slow down your editor, and you may see some duplicate highlights.
|
||||
-- Instead of true it can also be a list of languages
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
local parser_config = require('nvim-treesitter.parsers').get_parser_configs()
|
||||
|
||||
parser_config.blade = {
|
||||
install_info = {
|
||||
url = 'https://github.com/EmranMR/tree-sitter-blade',
|
||||
branch = "main",
|
||||
files = { 'src/parser.c' },
|
||||
generate_requires_npm = true,
|
||||
requires_generate_from_grammar = true,
|
||||
},
|
||||
filetype = 'blade',
|
||||
}
|
||||
|
||||
require("nvim-treesitter.configs").setup(opts)
|
||||
end,
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue