mirror of
https://github.com/pnx/dotfiles
synced 2026-06-17 03:30:01 +02:00
new nvim config
This commit is contained in:
parent
4b730d3924
commit
7388c9bfd3
78 changed files with 1291 additions and 43 deletions
187
nvim/lua/plugins/core.lua
Normal file
187
nvim/lua/plugins/core.lua
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
local keys = require('config.keymaps')
|
||||
|
||||
return {
|
||||
-- colorscheme
|
||||
{
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
config = function()
|
||||
require("catppuccin").setup(require('config.colorscheme'))
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end
|
||||
},
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = function() return {
|
||||
defaults = keys.whichkey
|
||||
} end,
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
wk.register(opts.defaults or {})
|
||||
end
|
||||
},
|
||||
{
|
||||
'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 = require('config.treesitter'),
|
||||
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,
|
||||
},
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = "InsertEnter",
|
||||
config = true
|
||||
},
|
||||
{
|
||||
"windwp/nvim-ts-autotag",
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter'
|
||||
},
|
||||
opts = {
|
||||
filetypes = {
|
||||
'html',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'javascriptreact',
|
||||
'typescriptreact',
|
||||
'svelte',
|
||||
'vue',
|
||||
'tsx',
|
||||
'jsx',
|
||||
'rescript',
|
||||
'xml',
|
||||
'php',
|
||||
'blade',
|
||||
'markdown',
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {
|
||||
debounce = 10,
|
||||
indent = {
|
||||
char = '▏',
|
||||
},
|
||||
scope = {
|
||||
enabled = true,
|
||||
show_start = false,
|
||||
show_end = false
|
||||
},
|
||||
exclude = {
|
||||
filetypes = {
|
||||
'help',
|
||||
'dashboard'
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
require 'ibl'.setup(opts)
|
||||
|
||||
local hooks = require 'ibl.hooks'
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_tab_indent_level)
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level)
|
||||
end
|
||||
},
|
||||
-- Git stuff
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
dependencies = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>g"] = { name = "+git" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
keys = keys.gitsigns or {},
|
||||
opts = require('config.gitsigns')
|
||||
|
||||
},
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
'arkav/lualine-lsp-progress',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
opts = require("config.lualine")
|
||||
},
|
||||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'sharkdp/fd',
|
||||
'nvim-telescope/telescope-ui-select.nvim',
|
||||
},
|
||||
keys = keys.telescope,
|
||||
opts = require('config.telescope'),
|
||||
config = function (_, opts)
|
||||
local telescope = require("telescope")
|
||||
|
||||
telescope.setup(opts)
|
||||
for name, _ in pairs(opts.extensions or {}) do
|
||||
telescope.load_extension(name)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
keys = keys.conform or {},
|
||||
opts = require('config.conform'),
|
||||
config = function(_, opts)
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
local range = nil
|
||||
if args.count ~= -1 then
|
||||
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
require("conform").format({ async = true, lsp_fallback = true, range = range })
|
||||
end, { range = true })
|
||||
|
||||
require('conform').setup(opts)
|
||||
end,
|
||||
},
|
||||
{
|
||||
'stevearc/oil.nvim',
|
||||
keys = keys.oil or {},
|
||||
opts = require('config.oil'),
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
'windwp/nvim-autopairs',
|
||||
event = "InsertEnter",
|
||||
config = true
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
return {
|
||||
"windwp/nvim-ts-autotag",
|
||||
dependencies = {
|
||||
'nvim-treesitter/nvim-treesitter'
|
||||
},
|
||||
opts = {
|
||||
filetypes = {
|
||||
'html',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'javascriptreact',
|
||||
'typescriptreact',
|
||||
'svelte',
|
||||
'vue',
|
||||
'tsx',
|
||||
'jsx',
|
||||
'rescript',
|
||||
'xml',
|
||||
'php',
|
||||
'blade',
|
||||
'markdown',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
return {
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
opts = {
|
||||
debounce = 10,
|
||||
indent = {
|
||||
char = '▏',
|
||||
},
|
||||
scope = {
|
||||
enabled = true,
|
||||
show_start = false,
|
||||
show_end = false
|
||||
},
|
||||
exclude = {
|
||||
filetypes = {
|
||||
'help',
|
||||
'dashboard'
|
||||
}
|
||||
}
|
||||
},
|
||||
config = function(_, opts)
|
||||
require 'ibl'.setup(opts)
|
||||
|
||||
local hooks = require 'ibl.hooks'
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_tab_indent_level)
|
||||
hooks.register(hooks.type.WHITESPACE, hooks.builtin.hide_first_space_indent_level)
|
||||
end
|
||||
}
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
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 = require('config.plugins.treesitter'),
|
||||
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,
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
return {
|
||||
'echasnovski/mini.comment',
|
||||
version = '*',
|
||||
opts = require('config.plugins.comment')
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
local config = require('config.plugins.telescope')
|
||||
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
main = 'telescope',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'sharkdp/fd',
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = config.key_groups or {},
|
||||
},
|
||||
},
|
||||
},
|
||||
keys = config.keys or {},
|
||||
opts = config.opts or {},
|
||||
config = function (_, opts)
|
||||
local override = {
|
||||
border = {
|
||||
prompt = { 1, 1, 1, 1 },
|
||||
results = { 1, 1, 1, 1 },
|
||||
preview = { 1, 1, 1, 1 },
|
||||
},
|
||||
-- borderchars = {
|
||||
-- prompt = { "─", "│", "─", "│", "├", "┤", "┴", "└" },
|
||||
-- results = { "─", "│", " ", "│", "┌", "┬", "│", "│" },
|
||||
-- preview = { "─", "│", "─", " ", "─", "┐", "┘", "─" },
|
||||
-- },
|
||||
}
|
||||
|
||||
opts.defaults = vim.tbl_deep_extend("force", opts.defaults, override)
|
||||
|
||||
require('telescope').setup(opts)
|
||||
end
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
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 = require('config.plugins.cmp'),
|
||||
config = function(_, opts)
|
||||
local cmp = require('cmp')
|
||||
|
||||
cmp.setup(opts)
|
||||
|
||||
-- insert () on function completion using autopairs
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
require('nvim-autopairs.completion.cmp').on_confirm_done()
|
||||
)
|
||||
end
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
local config = require('config.plugins.conform')
|
||||
|
||||
return {
|
||||
'stevearc/conform.nvim',
|
||||
dependencies = {
|
||||
"williamboman/mason.nvim",
|
||||
"zapling/mason-conform.nvim"
|
||||
},
|
||||
cmd = { "ConformInfo", "Format" },
|
||||
keys = config.keys or {},
|
||||
opts = config.opts or {},
|
||||
config = function (_, opts)
|
||||
|
||||
-- Create command to format a buffer or range.
|
||||
vim.api.nvim_create_user_command("Format", function(args)
|
||||
local range = nil
|
||||
if args.count ~= -1 then
|
||||
local end_line = vim.api.nvim_buf_get_lines(0, args.line2 - 1, args.line2, true)[1]
|
||||
range = {
|
||||
start = { args.line1, 0 },
|
||||
["end"] = { args.line2, end_line:len() },
|
||||
}
|
||||
end
|
||||
|
||||
local opt = opts.format_options
|
||||
if range ~= nil then
|
||||
opt = vim.tbl_deep_extend("force", opt, { range = range })
|
||||
end
|
||||
|
||||
require("conform").format(opt)
|
||||
end, { range = true })
|
||||
|
||||
require('conform').setup(opts)
|
||||
|
||||
-- setup mason-conform to autmagically install formatters.
|
||||
require('mason-conform').setup()
|
||||
end
|
||||
}
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
return {
|
||||
"zbirenbaum/copilot.lua",
|
||||
cmd = "Copilot",
|
||||
event = "InsertEnter",
|
||||
opts = {
|
||||
suggestion = {
|
||||
enabled = true,
|
||||
auto_trigger = true,
|
||||
keymap = {
|
||||
accept = "<C-F>",
|
||||
},
|
||||
},
|
||||
panel = {
|
||||
enabled = true,
|
||||
auto_refresh = true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
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" },
|
||||
{ "<leader>Db", function() require'dap'.toggle_breakpoint() end, desc = "Toggle breakpoint" },
|
||||
},
|
||||
config = function()
|
||||
vim.api.nvim_set_hl(0, "DapStoppedLine", { default = true, link = "Visual" })
|
||||
|
||||
local dap = require "dap"
|
||||
dap.adapters.delve = {
|
||||
type = 'server',
|
||||
port = '${port}',
|
||||
executable = {
|
||||
command = 'dlv',
|
||||
args = {'dap', '-l', '127.0.0.1:${port}'},
|
||||
}
|
||||
}
|
||||
|
||||
dap.configurations.go = {
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug",
|
||||
request = "launch",
|
||||
program = "${file}"
|
||||
},
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug test", -- configuration for debugging test files
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "${file}"
|
||||
},
|
||||
-- works with go.mod packages and sub packages
|
||||
{
|
||||
type = "delve",
|
||||
name = "Debug test (go.mod)",
|
||||
request = "launch",
|
||||
mode = "test",
|
||||
program = "./${relativeFileDirname}"
|
||||
}
|
||||
}
|
||||
-- local Config = require("lazyvim.config")
|
||||
|
||||
|
||||
-- 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,
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
return {
|
||||
'neovim/nvim-lspconfig',
|
||||
dependencies = {
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
{ 'folke/neodev.nvim', opts = {} },
|
||||
},
|
||||
opts = require('config.plugins.lsp'),
|
||||
config = function(_, opts)
|
||||
-- Setup Mason to automatically install LSP servers
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({ automatic_installation = true })
|
||||
local augroup = vim.api.nvim_create_augroup("Lsp", {})
|
||||
local lspconfig = require('lspconfig')
|
||||
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",
|
||||
})
|
||||
|
||||
vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with(
|
||||
vim.lsp.diagnostic.on_publish_diagnostics, {
|
||||
virtual_text = false,
|
||||
}
|
||||
)
|
||||
|
||||
for name, server_opt in pairs(opts.servers) do
|
||||
local on_attach = function(client, bufnr)
|
||||
for bind, settings in pairs(opts.mappings) do
|
||||
vim.keymap.set('n', bind, settings[1], vim.tbl_deep_extend("force", settings[2], { buffer = bufnr }))
|
||||
end
|
||||
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
|
||||
-- Add format on save if configured and client supports it.
|
||||
if server_opt.format_on_save and client.supports_method("textDocument/formatting") then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.format()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
if server_opt.on_save then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = server_opt.on_save,
|
||||
})
|
||||
end
|
||||
|
||||
|
||||
if client.supports_method("textDocument/documentHighlight") then
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function() vim.lsp.buf.document_highlight() end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorHoldI", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function() vim.lsp.buf.document_highlight() end
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("CursorMoved", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function() vim.lsp.buf.clear_references() end
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
lspconfig[name].setup({
|
||||
settings = server_opt.settings or {},
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach
|
||||
})
|
||||
end
|
||||
end
|
||||
}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
return {
|
||||
"folke/neodev.nvim",
|
||||
opts = {}
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
return {
|
||||
"nvim-neotest/neotest",
|
||||
dependencies = {
|
||||
"nvim-neotest/nvim-nio",
|
||||
"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", ":Neotest summary<cr>", desc = "Open test explorer"}
|
||||
},
|
||||
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
|
||||
},
|
||||
summery = {
|
||||
open = "botleft vsplit"
|
||||
}
|
||||
}
|
||||
end
|
||||
}
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
local conf = require("config.plugins.trouble") or {}
|
||||
|
||||
return {
|
||||
"folke/trouble.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
keys = conf.keys or {},
|
||||
opts = conf.opts or {},
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
return {
|
||||
"mbbill/undotree",
|
||||
keys = {
|
||||
{"<leader>u", ":UndotreeToggle<CR>", desc = "Toggle undotree"},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable", -- latest stable release
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
local opts = {
|
||||
dev = {
|
||||
path = "~/code/nvim_plugins",
|
||||
}
|
||||
}
|
||||
|
||||
require("lazy").setup({
|
||||
|
||||
-- Core
|
||||
-----------------------------
|
||||
{ import = "plugins.core.treesitter" },
|
||||
{ import = "plugins.core.autopairs" },
|
||||
{ import = "plugins.core.autotag" },
|
||||
{ import = "plugins.core.indent-blankline" },
|
||||
|
||||
-- Editor
|
||||
-----------------------------
|
||||
{ import = "plugins.editor.mini-comment" },
|
||||
{ import = "plugins.editor.telescope" },
|
||||
|
||||
-- UI
|
||||
-----------------------------
|
||||
{ import = "plugins.ui.catppuccin" },
|
||||
{ import = "plugins.ui.dressing" },
|
||||
{ import = "plugins.ui.edgy" },
|
||||
{ import = "plugins.ui.dashboard" },
|
||||
{ import = "plugins.ui.neo-tree" },
|
||||
{ import = "plugins.ui.bufferline" },
|
||||
{ import = "plugins.ui.lualine" },
|
||||
{ import = "plugins.ui.gitsigns" },
|
||||
{ import = "plugins.ui.which-key" },
|
||||
|
||||
-- IDE
|
||||
-----------------------------
|
||||
{ import = "plugins.ide.trouble" },
|
||||
{ import = "plugins.ide.undotree" },
|
||||
{ import = "plugins.ide.conform" },
|
||||
{ import = "plugins.ide.cmp" },
|
||||
{ import = "plugins.ide.lsp" },
|
||||
{ import = "plugins.ide.dap" },
|
||||
{ import = "plugins.ide.neotest" },
|
||||
{ import = "plugins.ide.neodev" },
|
||||
{ import = "plugins.ide.copilot" },
|
||||
|
||||
-- Language specific
|
||||
-----------------------------
|
||||
{ import = "plugins.lang.laravel" },
|
||||
{ import = "plugins.lang.go" },
|
||||
|
||||
}, opts)
|
||||
|
|
@ -1,15 +0,0 @@
|
|||
return {
|
||||
"ray-x/go.nvim",
|
||||
main = "go",
|
||||
dependencies = {
|
||||
"ray-x/guihua.lua",
|
||||
"neovim/nvim-lspconfig",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
config = function(opts)
|
||||
require('go').setup(opts)
|
||||
end,
|
||||
event = { "CmdlineEnter" },
|
||||
ft = { "go", 'gomod' },
|
||||
build = ':lua require("go.install").update_all_sync()'
|
||||
}
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
return {
|
||||
"adalessa/laravel.nvim",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"tpope/vim-dotenv",
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvimtools/none-ls.nvim",
|
||||
},
|
||||
ft = "php",
|
||||
cmd = { "Sail", "Artisan", "Composer", "Npm", "Yarn", "Laravel" },
|
||||
config = function(_, _)
|
||||
local opts = require('config.plugins.laravel')
|
||||
|
||||
local haswk, wk = pcall(require, "which-key")
|
||||
|
||||
if haswk then
|
||||
wk.register({ l = { name = "laravel" } }, { prefix = "<leader>" })
|
||||
end
|
||||
|
||||
for key, value in pairs(opts.keys) do
|
||||
vim.keymap.set("n", key, value[1], { desc = value[2] or '' })
|
||||
end
|
||||
|
||||
require('laravel').setup(opts)
|
||||
end
|
||||
}
|
||||
64
nvim/lua/plugins/lsp.lua
Normal file
64
nvim/lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
return {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v3.x',
|
||||
dependencies = {
|
||||
'neovim/nvim-lspconfig',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
|
||||
-- completion
|
||||
{
|
||||
'hrsh7th/nvim-cmp',
|
||||
version = false,
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
'hrsh7th/cmp-buffer',
|
||||
'hrsh7th/cmp-path',
|
||||
'hrsh7th/cmp-nvim-lsp',
|
||||
'L3MON4D3/LuaSnip',
|
||||
'onsails/lspkind-nvim',
|
||||
},
|
||||
opts = require('config.cmp'),
|
||||
config = function(_, opts)
|
||||
local cmp = require('cmp')
|
||||
cmp.setup(opts)
|
||||
|
||||
-- insert () on function completion using autopairs
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
require('nvim-autopairs.completion.cmp').on_confirm_done()
|
||||
)
|
||||
end
|
||||
},
|
||||
},
|
||||
opts = require('config.lsp'),
|
||||
config = function(_, opts)
|
||||
local lsp_zero = require('lsp-zero')
|
||||
local lsp_config = require('lspconfig')
|
||||
local augroup = vim.api.nvim_create_augroup("Lsp", {})
|
||||
local map = require('utils.keys')
|
||||
|
||||
lsp_zero.on_attach(function(_, bufnr)
|
||||
for _, v in ipairs(require('config.keymaps').lsp or {}) do
|
||||
map(v, { buffer = bufnr })
|
||||
end
|
||||
end)
|
||||
|
||||
for name, server_opt in pairs(opts.servers) do
|
||||
local on_attach = function(_, bufnr)
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
|
||||
if server_opt.on_save then
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = server_opt.on_save,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
server_opt = vim.tbl_deep_extend("force", {on_attach = on_attach}, server_opt or {})
|
||||
|
||||
lsp_config[name].setup(server_opt)
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
local icons = require('config.icons')
|
||||
|
||||
return {
|
||||
'romgrk/barbar.nvim',
|
||||
dependencies = {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
init = function() vim.g.barbar_auto_setup = false end,
|
||||
opts = {
|
||||
animation = false,
|
||||
auto_hide = 0,
|
||||
focus_on_close = 'previous',
|
||||
button = icons.close,
|
||||
highlight_inactive_file_icons = true,
|
||||
icons = {
|
||||
separator = { left = '', right = '' },
|
||||
separator_at_end = false,
|
||||
inactive = { button = '', separator = { left = '', right = '' } },
|
||||
modified = { button = icons.gitsigns.modified },
|
||||
pinned = { button = icons.pinned, filename = true },
|
||||
gitsigns = {
|
||||
added = { enabled = false },
|
||||
changed = { enabled = false },
|
||||
deleted = { enabled = false },
|
||||
}
|
||||
},
|
||||
maximum_padding = 2,
|
||||
minimum_padding = 1,
|
||||
sidebar_filetypes = {
|
||||
--['neo-tree'] = {event = 'BufWipeout'},
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
version = "*",
|
||||
dependencies = 'nvim-tree/nvim-web-devicons',
|
||||
opts = require('config.plugins.bufferline')
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
opts = require('config.plugins.catppuccin'),
|
||||
config = function(_, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end
|
||||
}
|
||||
|
|
@ -1,92 +0,0 @@
|
|||
return {
|
||||
"navarasu/onedark.nvim",
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
style = 'deep',
|
||||
code_style = {
|
||||
comments = 'none',
|
||||
keywords = 'none',
|
||||
functions = 'none',
|
||||
strings = 'none',
|
||||
variables = 'none'
|
||||
},
|
||||
-- colors = {
|
||||
-- fg = '#b3b1b1',
|
||||
-- bg0 = '#171b26',
|
||||
-- bg1 = '#30323b',
|
||||
-- bg2 = '#24262f',
|
||||
-- bg3 = '#383a43',
|
||||
-- bg_d = "#1f2129",
|
||||
-- bg_blue = "#ff00ff",
|
||||
-- bg_yellow = "#f0d197",
|
||||
-- red = '#cc4a33',
|
||||
-- green = '#51cc7f',
|
||||
-- yellow = '#ccaf33',
|
||||
-- orange = '#ccab1f',
|
||||
-- -- blue = '#3390cc',
|
||||
-- cyan = '#33ccb7',
|
||||
-- purple = '#9233cc',
|
||||
-- dark_cyan = "#8abeb7",
|
||||
-- dark_red = "#cc817f",
|
||||
-- dark_yellow = "#ffcc99",
|
||||
-- dark_purple = "#9999cc",
|
||||
-- },
|
||||
-- highlights = {
|
||||
-- LineNr = { fg = "$light_grey" },
|
||||
-- CursorLineNr = { fg = "$blue" },
|
||||
--
|
||||
-- Pmenu = { bg = "$bg2" },
|
||||
-- PmenuSel = { bg = "$bg_d", fg = "$fg" },
|
||||
-- FloatBorder = { fg = "$grey", bg = 'None' },
|
||||
-- -- Syntax
|
||||
-- ["@comment"] = { fg = "$red" },
|
||||
-- ["@string"] = { fg = "$purple" },
|
||||
-- ["@function"] = { fg = "$fg" },
|
||||
-- ["@keyword"] = { fg = "$yellow" },
|
||||
-- ["@keyword.import"] = { fg = "$yellow" },
|
||||
-- ["@keyword.function"] = { fg = "$yellow" },
|
||||
-- ["@keyword.conditional"] = { fg = "$yellow" },
|
||||
-- ["@keyword.operator"] = { fg = "$yellow" },
|
||||
-- ["@keyword.repeat"] = { fg = "$yellow" },
|
||||
-- ["@constant"] = { fg = "$green" },
|
||||
-- ["@tag"] = { fg = "$yellow" },
|
||||
-- ["@tag.delimiter"] = { fg = "$yellow" },
|
||||
-- ["@tag.attribute"] = { fg = "$yellow" },
|
||||
-- ["@type"] = { fg = "$blue" },
|
||||
-- ["@type.qualifier"] = { fg = "$yellow" },
|
||||
-- ["@type.definition"] = { fg = "$blue" },
|
||||
-- ["@type.builtin"] = { fg = "$blue" },
|
||||
-- ["@function.method"] = { fg = "$fg" },
|
||||
-- ["@function.call"] = { fg = "$fg" },
|
||||
-- ["@function.builtin"] = { fg = "$fg" },
|
||||
--
|
||||
-- ["@number"] = { fg = "$red" },
|
||||
-- ["@variable"] = { fg = "$green" },
|
||||
-- ["@variable.member"] = { fg = "$green" },
|
||||
-- ["@variable.builtin"] = { fg = "$green" },
|
||||
-- ["@variable.parameter"] = { fg = "$fg" },
|
||||
-- ["@property"] = { fg = "$orange" },
|
||||
-- -- ["@property"] = { fg = "$fg" },
|
||||
-- ["@punctuation.delimiter"] = { fg = "$fg" },
|
||||
-- ["@punctuation.bracket"] = { fg = "$fg" },
|
||||
-- ["@module"] = { fg = "$fg" },
|
||||
--
|
||||
-- -- php overrides
|
||||
-- ["@class_name.php"] = { fg = "$fg" },
|
||||
-- ["@extend_name.php"] = { fg = "$fg" },
|
||||
-- ["@implements_name.php"] = { fg = "$fg" },
|
||||
-- ["@namespace_name.php"] = { fg = "$fg" },
|
||||
-- ["@namespace_alias.php"] = { fg = "$fg" },
|
||||
-- }
|
||||
},
|
||||
config = function(_, opts)
|
||||
local c = require('onedark')
|
||||
c.setup(opts)
|
||||
c.load()
|
||||
|
||||
-- vim.cmd(string.format("highlight GitSignsAdd guifg='%s'", opts.colors.green))
|
||||
-- vim.cmd(string.format("highlight GitSignsChange guifg='%s'", opts.colors.yellow))
|
||||
-- vim.cmd(string.format("highlight GitSignsDelete guifg='%s'", opts.colors.red))
|
||||
end
|
||||
}
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
local logo = [[
|
||||
::::::::: :::: ::: ::: :::
|
||||
:+: :+: :+:+: :+: :+: :+:
|
||||
+:+ +:+ :+:+:+ +:+ +:+ +:+
|
||||
+#++:++#+ +#+ +:+ +#+ +#++:+
|
||||
+#+ +#+ +#+#+# +#+ +#+
|
||||
#+# #+# #+#+# #+# #+#
|
||||
### ### #### ### ###
|
||||
]]
|
||||
|
||||
logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
|
||||
return {
|
||||
'nvimdev/dashboard-nvim',
|
||||
name = 'dashboard',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons'
|
||||
},
|
||||
event = 'VimEnter',
|
||||
opts = {
|
||||
theme = 'doom',
|
||||
config = {
|
||||
header = vim.split(logo, "\n"),
|
||||
|
||||
center = {
|
||||
{ action = function() require('telescope.builtin').find_files() end, desc = " Find file", icon = " ", key = "f" },
|
||||
{ action = "ene | startinsert", desc = " New file", icon = " ", key = "n" },
|
||||
{ action = function() require('telescope.builtin').oldfiles() end, desc = " Recent files", icon = " ", key = "r" },
|
||||
{ action = function() require('telescope.builtin').live_grep() end, desc = " Find text", icon = " ", key = "g" },
|
||||
{ action = "Lazy", desc = " Lazy", icon = " ", key = "l" },
|
||||
{ action = "qa", desc = " Quit", icon = " ", key = "q" }
|
||||
},
|
||||
footer = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return { "Loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
|
||||
end,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
return {
|
||||
'stevearc/dressing.nvim',
|
||||
opts = {
|
||||
input = {
|
||||
title_pos = "center",
|
||||
border = "single",
|
||||
relative = "win",
|
||||
},
|
||||
select = {
|
||||
backend = { "telescope", "builtin" },
|
||||
telescope = require('telescope.themes').get_dropdown({
|
||||
borderchars = {
|
||||
prompt = { "─", "│", "─", "│", "┌", "┐", "┘", "└" },
|
||||
results = { "─", "│", "─", "│", "├", "┤", "┘", "└" },
|
||||
},
|
||||
max_height = 5
|
||||
}),
|
||||
builtin = {
|
||||
border = "single",
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
return {
|
||||
"folke/edgy.nvim",
|
||||
event = "VeryLazy",
|
||||
keys = {
|
||||
{ "<leader>ue", function() require("edgy").toggle() end, desc = "Edgy Toggle" },
|
||||
-- stylua: ignore
|
||||
{ "<leader>uE", function() require("edgy").select() end, desc = "Edgy Select Window" },
|
||||
},
|
||||
opts = {
|
||||
left = {
|
||||
{
|
||||
title = "Neo-Tree",
|
||||
ft = "neo-tree",
|
||||
filter = function(buf)
|
||||
return vim.b[buf].neo_tree_source == "filesystem"
|
||||
end,
|
||||
size = { height = 0.5 },
|
||||
},
|
||||
{
|
||||
title = "Test",
|
||||
ft = "neotest-summary"
|
||||
},
|
||||
"neo-tree",
|
||||
},
|
||||
options = {
|
||||
left = { size = 40 }
|
||||
},
|
||||
animate = {
|
||||
enabled = false,
|
||||
},
|
||||
exit_when_last = false
|
||||
}
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
local icons = require('config.icons').diff_gutter
|
||||
|
||||
return {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
dependencies = {
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
defaults = {
|
||||
["<leader>g"] = { name = "+git" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
keys = {
|
||||
{ '<leader>gp', '<cmd>Gitsigns preview_hunk<cr>', desc = 'Git preview diff' },
|
||||
{ '<leader>gb', '<cmd>Gitsigns blame_line<cr>', desc = 'Git blame' }
|
||||
},
|
||||
opts = {
|
||||
signs = {
|
||||
add = { text = icons.add },
|
||||
delete = { text = icons.delete },
|
||||
change = { text = icons.change },
|
||||
untracked = { text = icons.untracked },
|
||||
topdelete = { text = icons.delete },
|
||||
changedelete = { text = icons.change },
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
'arkav/lualine-lsp-progress',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
opts = require("config.plugins.lualine")
|
||||
}
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
return {
|
||||
'nvim-neo-tree/neo-tree.nvim',
|
||||
cmd = 'Neotree',
|
||||
keys = {
|
||||
{ '<leader>Fe', ':Neotree reveal toggle<CR>', desc = 'Toggle File Explorer'},
|
||||
},
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
opts = require('config.plugins.neo-tree')
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
return {
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.o.timeout = true
|
||||
vim.o.timeoutlen = 300
|
||||
end,
|
||||
opts = require('config.plugins.which-key'),
|
||||
config = function(_, opts)
|
||||
local wk = require("which-key")
|
||||
wk.setup(opts)
|
||||
wk.register(opts.defaults or {})
|
||||
end
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue