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

nvim: moved stuff around.

This commit is contained in:
Henrik Hautakoski 2025-04-19 11:25:56 +02:00
parent 300d300664
commit 0d7a5fab7b
22 changed files with 975 additions and 990 deletions

View file

@ -0,0 +1,258 @@
local custom_highlights = function(colors)
return {
CursorLine = { bg = colors.surface0 },
SignColumnSep = { bg = colors.surface0, fg = colors.lavender },
Visual = { bg = colors.surface1 },
FoldColumn = { fg = colors.surface2 },
-- Floating windows
NormalFloat = { fg = colors.text, bg = colors.crust },
FloatTitle = { fg = colors.base, bg = colors.blue },
FloatBorder = { fg = colors.surface1, bg = colors.crust },
-- Window separator
WinSeparator = { fg = colors.surface0 },
-- Menus
Pmenu = { link = "NormalFloat" },
PmenuSel = { bg = colors.surface2 },
PmenuSbar = { link = "Pmenu" },
PmenuThumb = { link = "PmenuSel" },
-- NoiceMini = { link = "NormalFloat" },
WhichKeyFloat = { link = "Pmenu" },
-- indent lines
IblScope = { fg = colors.surface0 },
-- Search matches
IncSearch = { bg = colors.yellow },
-- Autocomplete window
CmpItemAbbr = { fg = colors.overlay2 },
CmpItemKindText = { fg = colors.text },
-- CmpKind
CmpItemKindBladeNav = { fg = "#f55247" },
-- telescope
TelescopeNormal = { link = "NormalFloat" },
TelescopeBorder = { link = "FloatBorder" },
TelescopeTitle = { link = "FloatTitle" },
TelescopePromptNormal = { bg = colors.mantle },
TelescopePromptPrefix = { fg = colors.mauve },
TelescopePromptBorder = { fg = colors.mantle, bg = colors.mantle },
TelescopePreviewTitle = { fg = colors.crust, bg = colors.mauve },
TelescopeResultsNormal = { fg = colors.text, bg = colors.crust },
TelescopeResultsClass = { link = "CmpItemKindClass" },
TelescopeResultsInterface = { link = "CmpItemKindInterface" },
TelescopeResultsField = { link = "CmpItemKindField" },
TelescopeResultsFunction = { link = "CmpItemKindFunction" },
TelescopeResultsMethod = { link = "CmpItemKindMethod" },
TelescopeResultsNumber = { link = "CmpItemKindNumber" },
TelescopeResultsStruct = { link = "CmpItemKindStruct" },
TelescopeResultsConstant = { link = "CmpItemKindConstant" },
TelescopeResultsOperator = { link = "CmpItemKindOperator" },
TelescopeResultsVariable = { link = "CmpItemKindVariable" },
TelescopeResultsIdentifier = { link = "CmpItemKindIdentifier" },
TelescopeMatching = { fg = colors.lavender },
TelescopeSelection = { fg = colors.text, bg = colors.surface1 },
TelescopeIndicatorModified = { fg = colors.yellow },
TelescopeIndicatorReadonly = { fg = colors.red },
TelescopeIndicatorHidden = { link = "TelescopeResultsComment" },
-- Ufo
UfoFoldedEllipsis = { link = "Comment" },
-- Statusline
-- Something resets StatusLine highlight background, so use another one for now :)
-- StatusLine = { fg = colors.text, bg = colors.crust },
StatusLineLualine = { fg = colors.text, bg = colors.crust },
StatusLineNormal = { link = "StatusLineLualine" },
StatusLineSeparator = { fg = colors.rosewater, bg = colors.crust },
StatusLineInsert = { fg = colors.base, bg = colors.blue },
StatusLineVisual = { fg = colors.base, bg = colors.mauve },
StatusLineCommand = { fg = colors.base, bg = colors.yellow },
StatusLineReplace = { fg = colors.base, bg = colors.maroon },
-- Neotree
NeoTreeTabActive = { bg = colors.surface2, fg = colors.lavender },
NeoTreeTabInactive = { bg = colors.crust, fg = colors.surface2 },
NeoTreeTabSeparatorActive = { fg = colors.base, bg = colors.surface2 },
NeoTreeTabSeparatorInactive = { fg = colors.base, bg = colors.crust },
NeoTreeFileIcon = { link = "Normal" },
NeoTreeModified = { fg = colors.yellow },
NeoTreeWinSeparator = { link = "WinSeparator" },
-- BlinkCmp
BlinkCmpLabel = { link = 'CmpItemAbbr' },
BlinkCmpLabelMatch = { link = 'CmpItemAbbrMatch' },
BlinkCmpLabelDeprecated = { link = 'CmpItemAbbrDeprecated'},
BlinkCmpLabelDetail = { link = 'CmpItemMenu' },
BlinkCmpLabelDescription = { link = 'CmpItemMenu' },
BlinkCmpSource = { link = 'CmpItemMenu' },
BlinkCmpKind = { link = 'CmpItemKind' },
BlinkCmpKindText = { link = "CmpItemKindText" },
BlinkCmpKindMethod = { link = "CmpItemKindMethod" },
BlinkCmpKindFunction = { link = "CmpItemKindFunction" },
BlinkCmpKindConstructor = { link = "CmpItemKindConstructor" },
BlinkCmpKindField = { link = "CmpItemKindField" },
BlinkCmpKindVariable = { link = "CmpItemKindVariable" },
BlinkCmpKindClass = { link = "CmpItemKindClass" },
BlinkCmpKindInterface = { link = "CmpItemKindInterface" },
BlinkCmpKindModule = { link = "CmpItemKindModule" },
BlinkCmpKindProperty = { link = "CmpItemKindProperty" },
BlinkCmpKindUnit = { link = "CmpItemKindUnit" },
BlinkCmpKindValue = { link = "CmpItemKindValue" },
BlinkCmpKindEnum = { link = "CmpItemKindEnum" },
BlinkCmpKindKeyword = { link = "CmpItemKindKeyword" },
BlinkCmpKindSnippet = { link = "CmpItemKindSnippet" },
BlinkCmpKindColor = { link = "CmpItemKindColor" },
BlinkCmpKindFile = { link = "CmpItemKindFile" },
BlinkCmpKindReference = { link = "CmpItemKindReference" },
BlinkCmpKindFolder = { link = "CmpItemKindFolder" },
BlinkCmpKindEnumMember = { link = "CmpItemKindEnumMember" },
BlinkCmpKindConstant = { link = "CmpItemKindConstant" },
BlinkCmpKindStruct = { link = "CmpItemKindStruct" },
BlinkCmpKindEvent = { link = "CmpItemKindEvent" },
BlinkCmpKindOperator = { link = "CmpItemKindOperator" },
BlinkCmpKindTypeParameter = { link = "CmpItemKindTypeParameter" },
-- Neotest
NeoTestWinSelect = { fg = colors.mauve },
NeoTestIndent = { fg = colors.surface1 },
NeoTestExpandMarker = { link = "NeoTestIndent" },
NeoTestAdapterName = { fg = colors.mauve },
NeoTestFile = { fg = colors.lavender },
NeoTestDir = { fg = colors.blue },
NeoTestTarget = { fg = colors.blue },
NeoTestNamespace = { fg = colors.mauve },
NeoTestPassed = { fg = colors.green },
NeoTestFailed = { fg = colors.red },
NeoTestSkipped = { fg = colors.blue },
NeoTestRunning = { fg = colors.yellow },
NeoTestWatching = { fg = colors.yellow },
NeoTestMarked = { fg = colors.orange },
-- Diagnostics
DiagnosticUnderlineInfo = { style = {"undercurl"} },
DiagnosticUnderlineHint = { style = {"undercurl"} },
DiagnosticUnderlineWarn = { style = {"undercurl"} },
DiagnosticUnderlineError = { style = {"undercurl"} },
-- Markdown rendering
RenderMarkdownCode = { bg = colors.crust },
RenderMarkdownCodeInline = { fg = colors.rosewater, bg = colors.crust },
-- Syntax
PreProc = { fg = colors.mauve },
Operator = { fg = colors.flamingo },
Function = { link = "@text" },
Delimiter = { link = "Operator" },
Keyword = { fg = colors.yellow },
Include = { link = "Keyword" },
Repeat = { link = "Keyword" },
Conditional = { link = "Keyword" },
Type = { fg = colors.blue },
Label = { link = "String" },
String = { fg = colors.lavender },
Exception = { link = "Keyword" },
-- Treesitter tokens
["@constructor"] = { link = "Function" },
["@variable"] = { fg = colors.green },
["@variable.builtin"] = { link = "@variable" },
["@variable.parameter"] = { link = "@parameter" },
["@variable.member"] = { link = "@variable" },
["@parameter"] = { link = "@variable" },
["@keyword.function"] = { link = "Keyword" },
["@keyword.return"] = { link = "Keyword" },
["@keyword.operator"] = { link = "Keyword" },
["@property"] = { link = "@variable" },
["@tag"] = { link = "Keyword" },
["@tag.delimiter"] = { link = "@text" },
["@module"] = { link = "@text" },
["@namespace"] = { link = "@keyword" },
["@punctuation.bracket"] = { link = "@punctuation" },
-- LSP
["@lsp.type.property"] = { link = "@variable" },
["@lsp.type.namespace.go"] = { fg = colors.rosewater },
-- Bash
["@variable.parameter.bash"] = { fg = colors.rosewater },
-- Makefile
["@function.make"] = { link = "Keyword" },
["@string.special.symbol.make"] = { link = "@variable" },
-- Markup
["@markup.raw"] = { link = "@text" },
["@markup.strong"] = { fg = colors.blue },
["@markup.italic"] = { fg = colors.green },
-- PHP
["@keyword.import.php"] = { link = "@keyword" },
["@function.builtin.php"] = { fg = colors.blue },
["@class.name.php"] = { link = "@text" },
["@class.inherit.name.php"] = { link = "@text" },
["@class.implements.name.php"] = { link = "@text" },
["@interface.name.php"] = { link = "@text" },
["@namespace.name.php"] = { link = "@text" },
["@namespace.alias.name.php"] = { link = "@text" },
["@use.trait.name.php"] = { link = "@text" },
-- Blade
["@tag.blade"] = { fg = colors.mauve },
}
end
local options = {
flavour = "mocha",
transparent_background = not vim.g.neovide,
color_overrides = {
mocha = {
base = "#0E1019",
mantle = "#0D0F17",
crust = "#0C0D14",
surface0 = "#1a1c2d",
surface1 = "#343959",
surface2 = "#41476F",
overlay0 = "#3F4256",
overlay1 = "#5B5F7C",
overlay2 = "#767BA0",
text = "#eceef4",
},
},
no_italic = true,
no_bold = true,
custom_highlights = custom_highlights,
integrations = {
cmp = true,
treesitter = true,
neotree = true,
-- barbar = true,
-- noice = true,
telescope = {
enabled = true,
},
}
}
return {
"catppuccin/nvim",
name = "catppuccin",
lazy = false,
priority = 1000,
opts = options,
config = function(_, opts)
require("catppuccin").setup(opts)
vim.cmd.colorscheme("catppuccin")
end,
}

View file

@ -0,0 +1,27 @@
local icons = require('user.icons')
return {
"goolord/alpha-nvim",
config = function()
local alpha = require'alpha'
local dashboard = require'alpha.themes.dashboard'
dashboard.section.header.val = {
[[ __ ]],
[[ ___ ___ ___ __ __ /\_\ ___ ___ ]],
[[ / _ `\ / __`\ / __`\/\ \/\ \\/\ \ / __` __`\ ]],
[[/\ \/\ \/\ __//\ \_\ \ \ \_/ |\ \ \/\ \/\ \/\ \ ]],
[[\ \_\ \_\ \____\ \____/\ \___/ \ \_\ \_\ \_\ \_\]],
[[ \/_/\/_/\/____/\/___/ \/__/ \/_/\/_/\/_/\/_/]],
}
dashboard.section.buttons.val = {
dashboard.button("e", icons.files.text .. " New file" , ":ene <BAR> startinsert<CR>"),
dashboard.button("s", icons.search .. " Search files" , ":Telescope find_files<CR>"),
dashboard.button("o", icons.search .. " Old files" , ":Telescope oldfiles<CR>"),
dashboard.button("q", icons.close .. " Quit" , ":qa<CR>"),
}
alpha.setup(dashboard.config)
end
}

View file

@ -0,0 +1,54 @@
local icons = require('user.icons')
return {
-- indent lines
{
"lukas-reineke/indent-blankline.nvim",
main = "ibl",
opts = {
debounce = 10,
indent = {
char = icons.indent,
},
scope = {
enabled = 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,
},
{
"folke/todo-comments.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
opts = {
signs = false,
keywords = {
TODO = { color = "warning" },
},
highlight = {
keyword = 'fg',
}
}
},
-- color highlight in documents
{
'brenoprata10/nvim-highlight-colors',
opts = {
render = 'virtual',
virtual_symbol_position = 'eol',
virtual_symbol_prefix = '',
virtual_symbol_suffix = '',
}
},
}

View file

@ -0,0 +1,42 @@
local icons = require('user.icons').diff_gutter
local options = {
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 },
},
signs_staged = {
add = { text = icons.add },
delete = { text = icons.delete },
change = { text = icons.change },
topdelete = { text = icons.delete },
changedelete = { text = icons.change },
},
diff_opts = {
internal = true
},
preview_config = {
border = { " " },
}
}
return {
"lewis6991/gitsigns.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = {
{
"folke/which-key.nvim",
optional = true,
opts = {
defaults = {
["<leader>g"] = { name = "+git" },
},
},
},
},
opts = options,
}

View file

@ -1,5 +1,107 @@
local icons = require("user.icons")
local options = {
-- weird bug
-- hide_root_node = true,
popup_border_style = 'solid',
default_component_configs = {
indent = {
with_markers = true,
indent_marker = icons.tree.vertical,
last_indent_marker = icons.tree.nodelast,
indent_size = 2,
},
icon = {
folder_closed = icons.folder.closed,
folder_open = icons.folder.open,
folder_empty = icons.folder.empty,
folder_empty_open = icons.folder.empty_open,
default = icons.files.default,
},
modified = {
symbol = icons.modified,
},
name = {
highlight_opened_files = true,
},
git_status = {
symbols = icons.gitsigns,
align = "right",
},
},
sources = {
"filesystem",
-- "buffers",
-- "git_status",
-- "document_symbols",
},
source_selector = {
winbar = true, -- toggle to show selector on winbar
show_scrolled_off_parent_node = false, -- boolean
sources = { -- table
{
source = "filesystem",
display_name = " 󰉓 Files "
},
{
source = "buffers",
display_name = "  Buffers "
},
{
source = "git_status",
display_name = " 󰊢 Git "
},
{
source = "document_symbols",
display_name = "  Document Symbols "
},
},
content_layout = "center",
separator = { left = "", right= "" },
},
window = {
popup = {
size = {
height = "100%",
width = "100%",
},
position = "50%",
relative = "editor",
},
mappings = {
["<space>"] = "noop",
}
},
filesystem = {
follow_current_file = {
enabled = true,
},
use_libuv_file_watcher = true,
window = {
mappings = {
["."] = "noop", -- unbind set_root. I never use it but always hit the key :P
["~"] = "toggle_hidden",
}
},
},
buffers = {
window = {
mappings = {
["."] = "noop",
}
}
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function ()
vim.opt_local.statuscolumn = ''
vim.opt_local.foldcolumn = "0"
end
},
},
}
return {
"nvim-neo-tree/neo-tree.nvim",
branch = "v3.x",
@ -9,106 +111,6 @@ return {
"MunifTanjim/nui.nvim",
},
cmd = "Neotree",
opts = {
-- weird bug
-- hide_root_node = true,
popup_border_style = 'solid',
default_component_configs = {
indent = {
with_markers = true,
indent_marker = icons.tree.vertical,
last_indent_marker = icons.tree.nodelast,
indent_size = 2,
},
icon = {
folder_closed = icons.folder.closed,
folder_open = icons.folder.open,
folder_empty = icons.folder.empty,
folder_empty_open = icons.folder.empty_open,
default = icons.files.default,
},
modified = {
symbol = icons.modified,
},
name = {
highlight_opened_files = true,
},
git_status = {
symbols = icons.gitsigns,
align = "right",
},
},
sources = {
"filesystem",
"buffers",
"git_status",
"document_symbols",
},
source_selector = {
winbar = true, -- toggle to show selector on winbar
show_scrolled_off_parent_node = false, -- boolean
sources = { -- table
{
source = "filesystem",
display_name = " 󰉓 Files "
},
{
source = "buffers",
display_name = "  Buffers "
},
{
source = "git_status",
display_name = " 󰊢 Git "
},
{
source = "document_symbols",
display_name = "  Document Symbols "
},
},
content_layout = "center",
separator = { left = "", right= "" },
},
window = {
popup = {
size = {
height = "100%",
width = "100%",
},
position = "50%",
relative = "editor",
},
mappings = {
["<space>"] = "noop",
}
},
filesystem = {
follow_current_file = {
enabled = true,
},
use_libuv_file_watcher = true,
window = {
mappings = {
["."] = "noop", -- unbind set_root. I never use it but always hit the key :P
["~"] = "toggle_hidden",
}
},
},
buffers = {
window = {
mappings = {
["."] = "noop",
}
}
},
event_handlers = {
{
event = "neo_tree_buffer_enter",
handler = function ()
vim.opt_local.statuscolumn = ''
vim.opt_local.foldcolumn = "0"
end
},
},
},
opts = options
}

View file

@ -0,0 +1,58 @@
local icons = require('user.icons')
local opts = function()
local builtin = require("statuscol.builtin")
return {
-- Align current relative number to the right.
relculright = true,
ft_ignore = {
'help',
'alpha'
},
segments = {
{
click = "v:lua.ScSa",
sign = {
namespace = { "gitsigns" },
maxwidth = 1,
colwidth = 1,
foldclosed = true,
}
},
{
click = "v:lua.ScSa",
sign = {
name = { ".*" },
namespace = { ".*" },
maxwidth = 1,
foldclosed = true,
},
},
{
text = { " ", builtin.lnumfunc, " " },
click = "v:lua.ScLa",
},
{
text = { builtin.foldfunc, " " },
condition = { true, function (args) return args.fold.width > 0 end },
click = "v:lua.ScFa"
},
{
text = {
function(args)
local pos = vim.api.nvim_win_get_cursor(args.win)
return (args.lnum == pos[1] and "%#SignColumnSep#" or "")..icons.signcolum.separator
end,
},
},
}
}
end
-- Better status column
return {
"luukvbaal/statuscol.nvim",
event = { "BufReadPre", "BufNewFile", "BufAdd" },
opts = opts
}

View file

@ -1,5 +1,9 @@
local icons = require("user.icons")
--
-- Helper functions
--
local function indent_settings()
return (vim.bo.expandtab and "SPC" or "TAB")
.. ":"
@ -26,6 +30,141 @@ local function linter()
return "no linter"
end
--
-- Options
--
local options = {
options = {
globalstatus = true,
component_separators = "",
section_separators = "",
disabled_filetypes = {
statusline = {
"dashboard",
"alpha",
},
winbar = {
"neo-tree",
"NvimTree",
"alpha"
}
},
theme = {
normal = {
a = "StatusLineNormal",
b = "StatusLineLualine",
c = "StatusLineLualine",
x = "StatusLineLualine",
y = "StatusLineLualine",
z = "StatusLineLualine",
},
command = {
a = "StatusLineCommand",
},
insert = {
a = "StatusLineInsert",
},
visual = {
a = "StatusLineVisual",
},
replace = {
a = "StatusLineReplace",
},
},
},
sections = {
lualine_a = {
"mode",
},
lualine_b = {
{"branch"},
{
"diagnostics",
symbols = {
error = icons.diagnostics.error .. " ",
warn = icons.diagnostics.warn .. " ",
info = icons.diagnostics.info .. " ",
hint = icons.diagnostics.hint .. " ",
},
},
{
"diff",
symbols = {
added = icons.diff.added .. " ",
modified = icons.diff.modified .. " ",
removed = icons.diff.removed .. " ",
},
},
{
"lsp-status",
disabled_filetypes = {
"TelescopePrompt",
},
on_click = function (_, btn, _)
if btn == "l" then
vim.cmd(":LspInfo")
elseif btn == "r" then
vim.cmd(":LspRestart")
end
end
},
linter,
},
lualine_c = {},
lualine_x = {
{
"filetype",
cond = is_not_popup
},
{
"fileformat",
symbols = {
unix = "NL",
dos = "NLCR",
mac = 'NL'
}
},
indent_settings,
},
lualine_y = {
"location",
"progress",
},
lualine_z = {},
},
winbar = {
lualine_c = {
{ "filetype", icon_only = true },
{
"filename",
cond = is_not_popup,
path = 1,
symbols = vim.tbl_deep_extend("force", icons.file_status, {
unnamed = "",
})
},
},
},
inactive_winbar = {
lualine_c = {
{ "filetype", icon_only = true },
{
"filename",
cond = is_not_popup,
path = 1,
symbols = vim.tbl_deep_extend("force", icons.file_status, {
unnamed = "",
})
},
},
},
extensions = {
"lazy",
"neo-tree",
},
}
return {
"nvim-lualine/lualine.nvim",
event = "VeryLazy",
@ -33,136 +172,7 @@ return {
"nvim-tree/nvim-web-devicons",
"pnx/lualine-lsp-status",
},
opts = {
options = {
globalstatus = true,
component_separators = "",
section_separators = "",
disabled_filetypes = {
statusline = {
"dashboard",
"alpha",
},
winbar = {
"neo-tree",
"NvimTree",
"alpha"
}
},
theme = {
normal = {
a = "StatusLineNormal",
b = "StatusLineLualine",
c = "StatusLineLualine",
x = "StatusLineLualine",
y = "StatusLineLualine",
z = "StatusLineLualine",
},
command = {
a = "StatusLineCommand",
},
insert = {
a = "StatusLineInsert",
},
visual = {
a = "StatusLineVisual",
},
replace = {
a = "StatusLineReplace",
},
},
},
sections = {
lualine_a = {
"mode",
},
lualine_b = {
{"branch"},
{
"diagnostics",
symbols = {
error = icons.diagnostics.error .. " ",
warn = icons.diagnostics.warn .. " ",
info = icons.diagnostics.info .. " ",
hint = icons.diagnostics.hint .. " ",
},
},
{
"diff",
symbols = {
added = icons.diff.added .. " ",
modified = icons.diff.modified .. " ",
removed = icons.diff.removed .. " ",
},
},
{
"lsp-status",
disabled_filetypes = {
"TelescopePrompt",
},
on_click = function (_, btn, _)
if btn == "l" then
vim.cmd(":LspInfo")
elseif btn == "r" then
vim.cmd(":LspRestart")
end
end
},
linter,
},
lualine_c = {},
lualine_x = {
{
"filetype",
cond = is_not_popup
},
{
"fileformat",
symbols = {
unix = "NL",
dos = "NLCR",
mac = 'NL'
}
},
indent_settings,
},
lualine_y = {
"location",
"progress",
},
lualine_z = {},
},
winbar = {
lualine_c = {
{ "filetype", icon_only = true },
{
"filename",
cond = is_not_popup,
path = 1,
symbols = vim.tbl_deep_extend("force", icons.file_status, {
unnamed = "",
})
},
},
},
inactive_winbar = {
lualine_c = {
{ "filetype", icon_only = true },
{
"filename",
cond = is_not_popup,
path = 1,
symbols = vim.tbl_deep_extend("force", icons.file_status, {
unnamed = "",
})
},
},
},
extensions = {
"lazy",
"neo-tree",
},
},
opts = options,
init = function ()
-- disable mode in the command line, as its already shown in lualine
vim.o.showmode = false