mirror of
https://github.com/pnx/dotfiles
synced 2026-06-16 11:24:55 +02:00
Update nvim
This commit is contained in:
parent
5286b45f9d
commit
4c1b128c96
15 changed files with 223 additions and 72 deletions
65
nvim/lua/config/catppuccin.lua
Normal file
65
nvim/lua/config/catppuccin.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
return {
|
||||
flavour = "mocha",
|
||||
color_overrides = {
|
||||
mocha = {
|
||||
base = '#0E1019',
|
||||
mantle = '#131521',
|
||||
text = '#ECEEF4',
|
||||
}
|
||||
},
|
||||
highlight_overrides = {
|
||||
mocha = function(colors)
|
||||
return {
|
||||
CursorLine = { bg = colors.mantle },
|
||||
|
||||
-- indent lines
|
||||
IblScope = { fg = colors.overlay2 },
|
||||
|
||||
BufferCurrent = { fg = colors.text, bg = colors.base },
|
||||
-- BufferInactive = { bg=colors.base},
|
||||
-- BufferOffset = { bg = colors.mantle },
|
||||
-- BufferTabpageFill = {bg=colors.base},
|
||||
-- Bufferbar
|
||||
|
||||
-- Syntax
|
||||
Operator = { link = "@text" },
|
||||
Function = { link = "@text" },
|
||||
Delimiter = { link = "@text" },
|
||||
Include = { fg = colors.yellow },
|
||||
Keyword = { fg = colors.yellow },
|
||||
Repeat = { link = "Keyword" },
|
||||
Conditional = { link = "Keyword" },
|
||||
Type = { fg = colors.blue },
|
||||
String = { fg = colors.lavender },
|
||||
["@constructor"] = { link = "Function" },
|
||||
["@variable"] = { fg = colors.green },
|
||||
["@variable.builtin"] = { link = "@variable" },
|
||||
["@variable.parameter"] = { link = "@variable" },
|
||||
["@variable.member"] = { link = "@variable" },
|
||||
["@keyword.function"] = { link = "Keyword" },
|
||||
["@keyword.return"] = { link = "Keyword" },
|
||||
["@property"] = { link = "@variable" },
|
||||
["@tag"] = { link = "Keyword" },
|
||||
["@tag.delimiter"] = { link = "@text" },
|
||||
["@punctuation"] = { link = "@text" },
|
||||
["@punctuation.bracket"] = { link = "@punctuation" },
|
||||
["@lsp.type.property"] = { link = "@variable" },
|
||||
["@class_name.php"] = { link = "@text" },
|
||||
["@extend_name.php"] = { link = "@text" },
|
||||
["@implements_name.php"] = { link = "@text" },
|
||||
["@namespace_name.php"] = { link = "@text" },
|
||||
["@namespace_alias.php"] = { link = "@text" },
|
||||
}
|
||||
end
|
||||
},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
treesitter = true,
|
||||
barbar = true,
|
||||
neotree = true,
|
||||
noice = true,
|
||||
telescope = {
|
||||
enabled = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -27,6 +27,7 @@ map("v", "<S-d>", ":m '>+1<CR>gv=gv", { silent = true, desc = "move current sele
|
|||
-- copy/paste
|
||||
map("x", "<leader>p", [["_dP]], { silent = true, desc = "Paste over selected text without losing content in \"-register" })
|
||||
map({"n", "v"}, "<leader>y", [["+y]], { desc = "Yank to system clipboard register" })
|
||||
map("n", "<leader>p", [["+p]], { desc = "Paste from system clipboard register" })
|
||||
|
||||
-- File operations
|
||||
map("n", "<leader>fx", "<cmd>!chmod +x %<CR>", { silent = true, desc = "Set execute flag on current file" })
|
||||
|
|
@ -50,3 +51,8 @@ map("n", "<leader>rw", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]], {
|
|||
})
|
||||
|
||||
map("n", "Q", "<nop>")
|
||||
|
||||
-- diagnostics
|
||||
map("n", "<leader>DD", vim.diagnostic.open_float, { desc = "Open"})
|
||||
map("n", "<leader>Dn", vim.diagnostic.get_next, { desc = "Open"})
|
||||
map("n", "<leader>Dp", vim.diagnostic.get_prev, { desc = "Open"})
|
||||
|
|
|
|||
|
|
@ -22,7 +22,12 @@ set.cursorline = true
|
|||
set.number = true
|
||||
set.relativenumber = true
|
||||
set.numberwidth = 5
|
||||
set.statuscolumn = '%=%{v:relnum?v:relnum:v:lnum} %s '
|
||||
|
||||
-- sign column to the right.
|
||||
--set.statuscolumn = '%=%{v:relnum?v:relnum:v:lnum} %s '
|
||||
|
||||
-- sign column to the left
|
||||
set.statuscolumn = '%s %=%{v:relnum?v:relnum:v:lnum} '
|
||||
|
||||
-- indent
|
||||
set.tabstop = 4
|
||||
|
|
@ -38,10 +43,20 @@ vim.filetype.add({
|
|||
},
|
||||
})
|
||||
|
||||
-- Sign configuration
|
||||
--
|
||||
-- Diagnostics
|
||||
--
|
||||
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' })
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
severity_sort = true,
|
||||
float = {
|
||||
border = 'single',
|
||||
source = 'always',
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ local icons = require('config.icons')
|
|||
|
||||
return {
|
||||
'nvim-telescope/telescope.nvim',
|
||||
tag = '0.1.4',
|
||||
main = 'telescope',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
'sharkdp/fd',
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
-- optional = true,
|
||||
|
|
|
|||
|
|
@ -45,8 +45,7 @@ return {
|
|||
["<S-Tab>"] = selectPrev,
|
||||
["<Down>"] = selectNext,
|
||||
["<Tab>"] = selectNext,
|
||||
-- ["<esc>"] = close without removeing typed text,
|
||||
["<S-space>"] = cmp.mapping.complete(),
|
||||
["<esc>"] = cmp.mapping.abort(),
|
||||
['<CR>'] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
snippet = {
|
||||
|
|
@ -54,24 +53,24 @@ return {
|
|||
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
|
||||
-- },
|
||||
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' },
|
||||
|
|
|
|||
|
|
@ -8,7 +8,10 @@ return {
|
|||
opts = {
|
||||
mappings = {
|
||||
["<leader>rs"] = { vim.lsp.buf.rename, { desc = "Rename symbol" }},
|
||||
gd = { vim.lsp.buf.definition, { desc = "Goto definition" }}
|
||||
["<leader>ca"] = { vim.lsp.buf.code_action, { desc = "Code action" }},
|
||||
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 = {
|
||||
|
|
@ -19,7 +22,19 @@ return {
|
|||
}
|
||||
}
|
||||
},
|
||||
gopls = {},
|
||||
gopls = {
|
||||
format_on_save = true,
|
||||
settings = {
|
||||
gopls = {
|
||||
analyses = {
|
||||
unusedvariable = true,
|
||||
unusedwrite = true,
|
||||
useany = true
|
||||
},
|
||||
gofumpt = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
lua_ls = {
|
||||
settings = {
|
||||
Lua = {
|
||||
|
|
@ -41,6 +56,7 @@ return {
|
|||
-- 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
|
||||
|
|
@ -56,19 +72,49 @@ return {
|
|||
border = "single",
|
||||
})
|
||||
|
||||
local on_attach = function(ev)
|
||||
for bind, settings in pairs(opts.mappings) do
|
||||
vim.keymap.set('n', bind, settings[1], vim.tbl_deep_extend("force", settings[2], { buffer = ev.buf }))
|
||||
end
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
local settings = vim.tbl_deep_extend("force", server_opt.settings or {}, {
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
lspconfig[name].setup({
|
||||
settings = server_opt.settings or {},
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach
|
||||
})
|
||||
lspconfig[name].setup(settings)
|
||||
end
|
||||
end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ return {
|
|||
"cpp",
|
||||
"ninja",
|
||||
"cmake",
|
||||
"dockerfile",
|
||||
"make",
|
||||
"lua",
|
||||
"vim",
|
||||
|
|
@ -24,6 +25,8 @@ return {
|
|||
"phpdoc",
|
||||
"blade",
|
||||
"go",
|
||||
"gomod",
|
||||
"gosum",
|
||||
"javascript",
|
||||
"typescript",
|
||||
"css",
|
||||
|
|
|
|||
|
|
@ -31,9 +31,10 @@ require("lazy").setup({
|
|||
{ import = "plugins.ui.dressing" },
|
||||
{ import = "plugins.ui.noice" },
|
||||
{ import = "plugins.ui.dashboard" },
|
||||
{ import = "plugins.ui.colorscheme" },
|
||||
{ import = "plugins.ui.catppuccin" },
|
||||
{ import = "plugins.ui.neo-tree" },
|
||||
{ import = "plugins.ui.barbar" },
|
||||
{ import = "plugins.ui.barbecue" },
|
||||
{ import = "plugins.ui.lualine" },
|
||||
{ import = "plugins.ui.gitsigns" },
|
||||
{ import = "plugins.ui.which-key" },
|
||||
|
|
@ -45,9 +46,9 @@ require("lazy").setup({
|
|||
{ import = "plugins.ide.lsp" },
|
||||
{ import = "plugins.ide.dap" },
|
||||
{ import = "plugins.ide.neotest" },
|
||||
{ import = "plugins.ide.laravel" }
|
||||
{ import = "plugins.ide.laravel" },
|
||||
-- { import = "plugins.nvim-test" },
|
||||
|
||||
-- { import = "plugins.go" },
|
||||
--{ import = "plugins.go" },
|
||||
}, opts)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +0,0 @@
|
|||
return {
|
||||
"pnx/kodex.nvim",
|
||||
dev = true,
|
||||
config = function()
|
||||
require('kodex').load()
|
||||
end
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@ return {
|
|||
icons = {
|
||||
separator = {left = '', right = ''},
|
||||
separator_at_end = false,
|
||||
inactive = { button = '' },
|
||||
inactive = { button = '', separator = { left = '', right = ''} },
|
||||
modified = {button = icons.filetree.git.modified },
|
||||
pinned = {button = '', filename = true},
|
||||
},
|
||||
|
|
|
|||
12
nvim/lua/plugins/ui/barbecue.lua
Normal file
12
nvim/lua/plugins/ui/barbecue.lua
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
return {
|
||||
"utilyre/barbecue.nvim",
|
||||
name = "barbecue",
|
||||
version = "*",
|
||||
dependencies = {
|
||||
"SmiteshP/nvim-navic",
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
opts = {
|
||||
theme = "catppuccin",
|
||||
}
|
||||
}
|
||||
10
nvim/lua/plugins/ui/catppuccin.lua
Normal file
10
nvim/lua/plugins/ui/catppuccin.lua
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
name = "catppuccin",
|
||||
priority = 1000,
|
||||
opts = require('config.catppuccin'),
|
||||
config = function (_, opts)
|
||||
require("catppuccin").setup(opts)
|
||||
vim.cmd.colorscheme("catppuccin")
|
||||
end
|
||||
}
|
||||
|
|
@ -12,30 +12,27 @@ return {
|
|||
variables = 'none'
|
||||
},
|
||||
colors = {
|
||||
fg = '#ffffff',
|
||||
bg0 = '#282a33',
|
||||
fg = '#b3b1b1',
|
||||
bg0 = '#171b26',
|
||||
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',
|
||||
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 = {
|
||||
-- ColorColumn = { bg = "$bg2"},
|
||||
-- SignColumn = { bg = "$bg2"},
|
||||
-- LineNr = { fg = "$light_grey", bg = "$bg2" }
|
||||
LineNr = { fg = "$light_grey" },
|
||||
CursorLineNr = { fg = "$blue" },
|
||||
|
||||
|
|
@ -55,7 +52,7 @@ return {
|
|||
["@constant"] = { fg = "$green" },
|
||||
["@tag"] = { fg = "$yellow" },
|
||||
["@tag.delimiter"] = { fg = "$yellow" },
|
||||
["@tag.attribute"] = { fg = "$cyan" },
|
||||
["@tag.attribute"] = { fg = "$yellow" },
|
||||
["@type"] = { fg = "$blue" },
|
||||
["@type.qualifier"] = { fg = "$yellow" },
|
||||
["@type.definition"] = { fg = "$blue" },
|
||||
|
|
@ -91,6 +88,5 @@ 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))
|
||||
|
||||
end
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ return {
|
|||
},
|
||||
opts = {
|
||||
options = {
|
||||
theme = "catppuccin-mocha",
|
||||
component_separators = '',
|
||||
globalstatus = true,
|
||||
disabled_filetypes = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue