1
0
Fork 0
mirror of https://github.com/pnx/dotfiles synced 2026-06-16 11:24:55 +02:00

big nvim update. maybe broke something

This commit is contained in:
Henrik Hautakoski 2024-03-10 10:36:20 +01:00
parent 1e68462bc1
commit 8a39a1b88a
32 changed files with 531 additions and 195 deletions

View file

@ -1,27 +0,0 @@
return {
'nvimdev/dashboard-nvim',
name = 'dashboard',
dependencies = {
'nvim-tree/nvim-web-devicons'
},
event = 'VimEnter',
opts = {
config = {
header = {
'::::::::: :::: ::: ::: :::',
':+: :+: :+:+: :+: :+: :+:',
'+:+ +:+ :+:+:+ +:+ +:+ +:+ ',
'+#++:++#+ +#+ +:+ +#+ +#++:+ ',
'+#+ +#+ +#+#+# +#+ +#+ ',
'#+# #+# #+#+# #+# #+#',
'### ### #### ### ###',
'',
},
shortcut = {
{ desc = '󰊳 Update', group = '@property', action = 'Lazy update', key = 'u' }
},
footer = {}
}
}
}

View file

@ -4,7 +4,8 @@ return{
opts = {
scope = {
enabled = true,
show_exact_scope = true,
show_start = false,
show_end = false
},
exclude = {
filetypes = {

View file

@ -6,7 +6,16 @@ return {
main = 'telescope',
dependencies = {
'nvim-lua/plenary.nvim',
'nvim-tree/nvim-web-devicons'
'nvim-tree/nvim-web-devicons',
{
"folke/which-key.nvim",
-- optional = true,
opts = {
defaults = {
["<leader>s"] = { name = "+search" },
},
},
},
},
keys = require('config.telescope'),
opts = function()
@ -14,6 +23,17 @@ return {
return {
defaults = {
path_display = { truncate = 1 },
-- borderchars = { "─", "│", "─", "│", "┌", "┐", "┘", "└" },
border = {
prompt = { 1, 1, 1, 1 },
results = { 1, 1, 1, 1 },
preview = { 1, 1, 1, 1 },
},
borderchars = {
prompt = { "", "", "", "", "", "", "", "" },
results = { "", "", " ", "", "", "", "", "" },
preview = { "", "", "", " ", "", "", "", "" },
},
prompt_prefix = ' ' .. icons.prompt .. ' ',
selection_caret = icons.current .. ' ',
multi_icon = icons.selected .. ' ',

View 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
}

View 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,
}

View 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,
}

View 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
}

View file

@ -5,14 +5,24 @@ return {
"antoinemadec/FixCursorHold.nvim",
"nvim-treesitter/nvim-treesitter",
"nvim-neotest/neotest-go",
"olimorris/neotest-phpunit"
"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"},
{"<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
@ -28,10 +38,10 @@ return {
child_indent = "",
child_prefix = "",
collapsed = "",
expanded = "",
expanded = "",
failed = icons.failed,
final_child_indent = " ",
final_child_prefix = "",
final_child_prefix = "",
non_collapsible = "",
passed = icons.ok,
running = icons.running,

View file

@ -21,6 +21,7 @@ return {
"vimdoc",
"query",
"php",
"phpdoc",
"blade",
"go",
"javascript",

View file

@ -11,44 +11,43 @@ if not vim.loop.fs_stat(lazypath) then
end
vim.opt.rtp:prepend(lazypath)
local opts = {
dev = {
path = "~/code/nvim_plugins",
}
}
require("lazy").setup({
{ import = "plugins.dashboard" },
-- Editor
--------------------
{ import = "plugins.editor.indent" },
{ import = "plugins.editor.autopairs" },
{ import = "plugins.editor.mini-comment" },
{ import = "plugins.editor.telescope" },
-- Highlight
{ import = "plugins.colorscheme" },
-- UI
--------------------
{ import = "plugins.ui.dressing" },
{ import = "plugins.ui.noice" },
{ import = "plugins.ui.dashboard" },
{ import = "plugins.ui.colorscheme" },
{ import = "plugins.ui.neo-tree" },
{ import = "plugins.ui.barbar" },
{ import = "plugins.ui.lualine" },
{ import = "plugins.ui.gitsigns" },
{ import = "plugins.ui.which-key" },
{ import = "plugins.indent" },
{ import = "plugins.nvim-autopairs" },
{ import = "plugins.mini-comment" },
{ import = "plugins.barbar" },
-- IDE
--------------------
{ import = "plugins.ide.treesitter" },
{ import = "plugins.ide.cmp" },
{ import = "plugins.ide.lsp" },
{ import = "plugins.ide.dap" },
{ import = "plugins.ide.neotest" },
{ import = "plugins.ide.laravel" }
-- { import = "plugins.nvim-test" },
-- Filetree
{ import = "plugins.neo-tree" },
-- Status line
{ import = "plugins.lualine" },
-- Fuzzy finder
{ import = "plugins.telescope" },
-- Keybind helper
{ import = "plugins.which-key" },
-- Treesitter
{ import = "plugins.treesitter" },
{ import = "plugins.neotest" },
-- LSP
{ import = "plugins.lsp" },
{ import = "plugins.nvim-cmp" },
{ import = "plugins.go" },
{ import = "plugins.nvim-test" },
-- Git changes in gutter
{ import = "plugins.gitsigns" },
})
-- { import = "plugins.go" },
}, opts)

View file

@ -0,0 +1,7 @@
return {
"pnx/kodex.nvim",
dev = true,
config = function()
require('kodex').load()
end
}

View file

@ -73,12 +73,5 @@ return {
capabilities = capabilities
})
-- Config
-- Sign configuration
local icons = require('config.icons').diagnostics
vim.fn.sign_define('DiagnosticSignError', { text = icons.error, texthl = 'DiagnosticSignError' })
vim.fn.sign_define('DiagnosticSignWarn', { text = icons.warn, texthl = 'DiagnosticSignWarn' })
vim.fn.sign_define('DiagnosticSignInfo', { text = icons.info, texthl = 'DiagnosticSignInfo' })
vim.fn.sign_define('DiagnosticSignHint', { text = icons.hint, texthl = 'DiagnosticSignHint' })
end
}

View file

@ -1,70 +0,0 @@
return {
'hrsh7th/nvim-cmp',
dependencies = {
'hrsh7th/cmp-nvim-lsp',
'hrsh7th/cmp-nvim-lsp-signature-help',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-path',
'L3MON4D3/LuaSnip',
'onsails/lspkind-nvim',
},
config = function()
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({
preselect = false,
view = {
entries = { name = 'custom', selection_order = 'near_cursor' },
},
mapping = {
["<Tab>"] = moveDown,
["<Down>"] = moveDown,
["<S-Tab>"] = moveUp,
["<Up>"] = moveUp,
['<CR>'] = cmp.mapping.confirm({ select = true }),
},
formatting = {
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
return require('lspkind').cmp_format({ with_text = true })(entry, vim_item)
end
},
sources = {
{ name = 'nvim_lsp', max_item_count = 10 },
{ name = 'nvim_lsp_signature_help' },
{ name = 'buffer' },
{ name = 'path' },
},
})
end
}

View file

@ -16,16 +16,34 @@ return {
bg0 = '#282a33',
bg1 = '#30323b',
bg2 = '#24262f',
bg3 = '#383a43',
bg_d = "#1f2129",
bg_blue = "#ff00ff",
bg_yellow = "#f0d197",
red = '#cc817f',
green = '#7ccfaf',
yellow = '#ffcc99',
orange = '#ffcc99',
blue = '#8ac6f2',
cyan = '#8abeb7',
purple = '#9999cc'
purple = '#9999cc',
dark_cyan = "#8abeb7",
dark_red = "#cc817f",
dark_yellow = "#ffcc99",
dark_purple = "#9999cc",
},
highlights = {
-- ColorColumn = { bg = "$bg2"},
-- SignColumn = { bg = "$bg2"},
-- LineNr = { fg = "$light_grey", bg = "$bg2" }
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" },
@ -33,19 +51,36 @@ return {
["@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 = "$cyan" },
["@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 = "$green" },
["@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)
@ -56,6 +91,6 @@ return {
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))
-- vim.api.nvim_command("highlight GitSign"
end
}

View file

@ -0,0 +1,42 @@
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,
}
}
}

View file

@ -0,0 +1,23 @@
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",
}
}
},
}

View file

@ -2,6 +2,17 @@ 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' },

View file

@ -0,0 +1,16 @@
return {
"folke/noice.nvim",
event = "VeryLazy",
opts = {
cmdline = {
view = "cmdline"
},
presets = {
bottom_search = true,
command_palette = true
}
},
dependencies = {
"MunifTanjim/nui.nvim",
}
}

View file

@ -0,0 +1,22 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {
defaults = {
mode = { "n", "v" },
["<leader>r"] = { name = "+rename" },
["<leader>b"] = { name = "+buffers" },
["<leader>f"] = { name = "+files" },
}
},
config = function(_, opts)
local wk = require("which-key")
wk.setup(opts)
wk.register(opts.defaults)
end
}

View file

@ -1,21 +0,0 @@
return {
"folke/which-key.nvim",
event = "VeryLazy",
init = function()
vim.o.timeout = true
vim.o.timeoutlen = 300
end,
opts = {},
config = function()
local wk = require("which-key")
wk.register({
f = 'file',
b = 'buffers',
t = 'test',
g = 'git',
s = 'search'
}, { prefix = "<leader>" })
end
}