feat: nixvim config

currently only for dnsc-air. can simply be imported in other hosts
This commit is contained in:
Dennis Schoepf 2026-02-04 19:03:10 +01:00
parent ff32ecb811
commit 6543d4a7f3
21 changed files with 1541 additions and 10 deletions

View file

@ -35,7 +35,7 @@
fd
sd
bat
neovim
vim
just
tldr
fortune
@ -52,5 +52,6 @@
nix-prefetch
nix-prefetch-github
dua
opencode
];
}

View file

@ -177,6 +177,7 @@
setup_path = /* fish */ ''
fish_add_path /run/wrappers/bin
fish_add_path /run/current-system/sw/bin
fish_add_path $HOME/.nix-profile/bin
if test "$(uname)" = "Darwin"
fish_add_path /nix/var/nix/profiles/default/bin

45
modules/nixvim/ai.nix Normal file
View file

@ -0,0 +1,45 @@
{ ... }:
{
plugins.opencode = {
enable = true;
settings = {
provider.enabled = "tmux";
};
};
keymaps = [
{
action.__raw = ''function() require("opencode").ask("@this: ", { submit = true }) end'';
key = "<leader>at";
options.desc = "ask opencode about this";
}
{
action.__raw = ''function() require("opencode").toggle() end'';
key = "<leader>aa";
options.desc = "toggle opencode";
}
{
action.__raw = ''function() require("opencode").select() end'';
key = "<leader>as";
options.desc = "select an opencode action";
}
{
mode = [
"n"
"x"
];
action.__raw = ''function() return require("opencode").operator("@this ") end'';
key = "go";
options.desc = "add range to opencode";
}
{
mode = [
"n"
];
action.__raw = ''function() return require("opencode").operator("@this ") .. "_" end'';
key = "go";
options.desc = "add line to opencode";
}
];
}

View file

@ -0,0 +1,13 @@
{ ... }:
{
colorscheme = "winterly";
# Make palette available to this module but
# also for other configuration (e.g. lualine)
extraFiles."lua/dnsc/palette.lua".source = ./extraFiles/palette.lua;
# Set custorscheme in neovims runtimepath so that neovim
# discovers it automatically
extraFiles."colors/winterly.lua".source = ./extraFiles/winterly.lua;
}

View file

@ -0,0 +1,21 @@
{
plugins.blink-cmp = {
enable = true;
settings = {
keymap = {
preset = "default";
};
appearance = {
nerd_font_variant = "mono";
};
completion = {
documentation = {
auto_show = false;
};
};
signature = {
enabled = true;
};
};
};
}

View file

@ -0,0 +1,26 @@
{ ... }:
# These options are imported in nixvim.imports and therefore
# every option here lives within `programs.nixvim`
{
enable = true;
defaultEditor = true;
# Setup some aliases
vimAlias = true;
vimdiffAlias = true;
imports = [
./colorscheme.nix
./completion.nix
./editing.nix
./picker.nix
./formatter.nix
./git.nix
./lsp.nix
./options.nix
./statusline.nix
./keybindings.nix
./ai.nix
];
}

View file

@ -0,0 +1,65 @@
{ pkgs, ... }:
{
plugins.sleuth.enable = true;
plugins.nvim-surround.enable = true;
plugins.flash.enable = true;
plugins.blink-pairs = {
enable = true;
};
plugins.treesitter = {
enable = true;
highlight.enable = true;
indent.enable = true;
folding.enable = true;
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
angular
bash
css
html
javascript
jsdoc
json
lua
make
markdown
markdown_inline
go
gomod
gotmpl
python
tsx
typescript
nix
regex
toml
vim
vimdoc
xml
yaml
];
};
plugins.substitute = {
enable = true;
luaConfig.post = /* lua */ ''
local sub = require("substitute")
vim.keymap.set("n", "s", sub.operator, { noremap = true })
vim.keymap.set("n", "ss", sub.line, { noremap = true })
vim.keymap.set("n", "S", sub.eol, { noremap = true })
vim.keymap.set("x", "s", sub.visual, { noremap = true })
'';
};
autoCmd = [
{
callback.__raw = "function() vim.highlight.on_yank() end";
event = [
"TextYankPost"
];
}
];
}

View file

@ -0,0 +1,33 @@
return {
fg = "#ffffff",
fg_alt = "#bf8a9f",
fg_dim = "#807c9f",
bg = "#0f0b15",
bg_secondary = "#1d202f",
grey = "#807c9f",
grey_bright = "#807c9f",
red = "#f47359",
red_bright = "#ff6a7a",
red_subtle_bg = "#67182f",
green = "#29a444",
green_bright = "#00a392",
green_subtle_bg = "#10452f",
yellow = "#b58a52",
yellow_bright = "#df9080",
yellow_brighter = "#FCC1B6",
yellow_subtle_bg = "#54362a",
blue = "#3f95f6",
blue_bright = "#029fff",
blue_subtle_bg = "#2a346e",
blue_subtle_dark_bg = "#003045",
magenta = "#d369af",
magenta_bright = "#af85ea",
magenta_brighter = "#c57faf",
magenta_subtle_bg = "#572454",
magenta_subtle_bg_darker = "#331531",
cyan = "#4fbaef",
cyan_bright = "#35afbf",
cyan_subtle_bg = "#133d56",
silver = "#b8c6d5",
silver_bright = "#ffffff",
}

View file

@ -0,0 +1,368 @@
local palette = require("dnsc.palette")
vim.cmd.highlight("clear")
vim.g.colors_name = "winterly"
local hi = function(name, val)
-- Force links
val.force = true
-- Make sure that `cterm` attribute is not populated from `gui`
val.cterm = val.cterm or {} ---@type vim.api.keyset.highlight
-- Define global highlight
vim.api.nvim_set_hl(0, name, val)
end
-- General
hi("Normal", { fg = palette.fg })
hi("Conceal", { fg = palette.silver, bg = palette.grey, ctermfg = "LightGrey", ctermbg = "DarkGrey" })
hi("Cursor", { bg = palette.magenta_bright })
hi("DiffText", { bg = palette.yellow_subtle_bg, bold = true, ctermbg = "DarkYellow", cterm = { bold = true } })
hi("ErrorMsg", { fg = palette.red_bright, bg = palette.red_subtle_bg, ctermfg = "White", ctermbg = "DarkRed" })
hi("IncSearch", { bg = palette.magenta_subtle_bg, fg = palette.magenta })
hi("ModeMsg", { bold = true, cterm = { bold = true } })
hi("NonText", { fg = palette.grey, ctermfg = "DarkGrey" })
hi("PmenuSbar", { bg = palette.grey, ctermbg = "Grey" })
hi("StatusLine", { reverse = true, bold = true, cterm = { reverse = true, bold = true } })
hi("StatusLineNC", { reverse = true, cterm = { reverse = true } })
hi("TabLineFill", { reverse = true, cterm = { reverse = true } })
hi("TabLineSel", { bold = true, cterm = { bold = true } })
hi("TermCursor", { reverse = true, cterm = { reverse = true } })
hi("WinBar", { bold = true, cterm = { bold = true } })
hi("WildMenu", { fg = palette.bg, bg = palette.yellow_subtle_bg, ctermfg = "Black", ctermbg = "Yellow" })
hi("VertSplit", { link = "Comment" })
hi("WinSeparator", { link = "VertSplit" })
hi("WinBarNC", { link = "WinBar" })
hi("DiffTextAdd", { link = "DiffText" })
hi("EndOfBuffer", { link = "NonText" })
hi("LineNrAbove", { link = "LineNr" })
hi("LineNrBelow", { link = "LineNr" })
hi("QuickFixLine", { link = "Search" })
hi("CursorLineSign", { link = "SignColumn" })
hi("CursorLineFold", { link = "FoldColumn" })
hi("CurSearch", { link = "Search" })
hi("PmenuKind", { link = "Pmenu" })
hi("PmenuKindSel", { link = "PmenuSel" })
hi("PmenuMatch", { link = "Pmenu" })
hi("PmenuMatchSel", { link = "PmenuSel" })
hi("PmenuExtra", { link = "Pmenu" })
hi("PmenuExtraSel", { link = "PmenuSel" })
hi("PreInsert", { link = "Added" })
hi("ComplMatchIns", {})
hi("ComplHint", { link = "NonText" })
hi("ComplHintMore", { link = "MoreMsg" })
hi("Whitespace", { link = "NonText" })
hi("MsgSeparator", { link = "StatusLine" })
hi("NormalFloat", { link = "Pmenu" })
hi("FloatBorder", { bg = palette.bg_secondary, fg = palette.fg_dim })
hi("FloatTitle", { bg = palette.bg_secondary, fg = palette.fg, bold = true })
hi("FloatFooter", { link = "Title" })
hi("FloatShadow", { bg = palette.bg, blend = 80 })
hi("FloatShadowThrough", { bg = palette.bg, blend = 100 })
hi("RedrawDebugNormal", { reverse = true, cterm = { reverse = true } })
hi("RedrawDebugClear", { bg = palette.yellow_subtle_bg, ctermbg = "DarkYellow" })
hi("RedrawDebugComposed", { bg = palette.green_subtle_bg, ctermbg = "DarkGreen" })
hi("RedrawDebugRecompose", { bg = palette.red_subtle_bg, ctermbg = "DarkRed" })
hi("Error", { link = "ErrorMsg" })
hi("NvimInternalError", { link = "ErrorMsg" })
hi("Todo", { fg = palette.blue_bright, bg = palette.blue_subtle_bg, ctermbg = "DarkBlue", ctermfg = "LightBlue" })
hi("String", { link = "Constant" })
hi("Character", { link = "Constant" })
hi("Number", { link = "Boolean" })
hi("Boolean", { fg = palette.magenta_bright, bold = true })
hi("Float", { link = "Number" })
hi("Function", { link = "Identifier" })
hi("Conditional", { link = "Statement" })
hi("Repeat", { link = "Statement" })
hi("Label", { link = "Statement" })
hi("Operator", { fg = palette.fg_alt, italic = false, ctermfg = "White" })
hi("Keyword", { link = "Statement" })
hi("Exception", { link = "Statement" })
hi("Include", { link = "PreProc" })
hi("Define", { link = "PreProc" })
hi("Macro", { link = "PreProc" })
hi("PreCondit", { link = "PreProc" })
hi("StorageClass", { link = "Type" })
hi("Structure", { link = "Type" })
hi("Typedef", { bold = true, fg = palette.yellow_brighter, ctermfg = "LightYellow" })
hi("Tag", { link = "Special" })
hi("SpecialChar", { link = "Special" })
hi("Delimiter", { link = "Special" })
hi("SpecialComment", { link = "Special" })
hi("Debug", { link = "Special" })
hi("DiagnosticError", { fg = palette.red_bright, ctermfg = 1 })
hi("DiagnosticWarn", { fg = palette.yellow, ctermfg = 3 })
hi("DiagnosticInfo", { fg = palette.cyan, ctermfg = 4 })
hi("DiagnosticHint", { fg = palette.silver, ctermfg = 7 })
hi("DiagnosticOk", { fg = palette.green_bright, ctermfg = 10 })
hi("DiagnosticUnderlineError", { fg = palette.red_bright, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineWarn", { fg = palette.yellow, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineInfo", { fg = palette.cyan, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineHint", { fg = palette.silver, undercurl = true, cterm = { underline = true } })
hi("DiagnosticUnderlineOk", { fg = palette.green_bright, undercurl = true, cterm = { underline = true } })
hi("DiagnosticVirtualTextError", { link = "DiagnosticError" })
hi("DiagnosticVirtualTextWarn", { link = "DiagnosticWarn" })
hi("DiagnosticVirtualTextInfo", { link = "DiagnosticInfo" })
hi("DiagnosticVirtualTextHint", { link = "DiagnosticHint" })
hi("DiagnosticVirtualTextOk", { link = "DiagnosticOk" })
hi("DiagnosticFloatingError", { link = "DiagnosticError" })
hi("DiagnosticFloatingWarn", { link = "DiagnosticWarn" })
hi("DiagnosticFloatingInfo", { link = "DiagnosticInfo" })
hi("DiagnosticFloatingHint", { link = "DiagnosticHint" })
hi("DiagnosticFloatingOk", { link = "DiagnosticOk" })
hi("DiagnosticSignError", { link = "DiagnosticError" })
hi("DiagnosticSignWarn", { link = "DiagnosticWarn" })
hi("DiagnosticSignInfo", { link = "DiagnosticInfo" })
hi("DiagnosticSignHint", { link = "DiagnosticHint" })
hi("DiagnosticSignOk", { link = "DiagnosticOk" })
hi("DiagnosticDeprecated", { fg = palette.red, strikethrough = true, cterm = { strikethrough = true } })
hi("DiagnosticUnnecessary", { link = "Unused" })
hi("LspInlayHint", { link = "NonText" })
hi("SnippetTabstop", { link = "Visual" })
hi("SnippetTabstopActive", { link = "SnippetTabstop" })
-- Text
hi("@markup.raw", { link = "Special" })
hi("@markup.link", { link = "Identifier" })
hi("@markup.link.label", { link = "ConstantUnderlined" })
hi("@markup.heading", { link = "Title" })
hi("@markup.heading.gitcommit", { bg = palette.bg, fg = palette.fg, bold = true })
hi("@markup.link.url", { link = "Underlined" })
hi("@markup.underline", { link = "Underlined" })
hi("@comment.todo", { link = "Todo" })
-- Miscs
hi("@comment", { link = "Comment" })
hi("@punctuation", { link = "Delimiter" })
-- Constants
hi("@constant", { link = "Constant" })
hi("@constant.builtin", { link = "Special" })
hi("@constant.macro", { link = "Define" })
hi("@keyword.directive", { link = "Define" })
hi("@string", { link = "String" })
hi("@string.escape", { link = "SpecialChar" })
hi("@string.special", { link = "SpecialChar" })
hi("@character", { link = "Character" })
hi("@character.special", { link = "SpecialChar" })
hi("@number", { link = "Number" })
hi("@boolean", { link = "Boolean" })
hi("@number.float", { link = "Float" })
-- Functions
hi("@function", { link = "Function" })
hi("@function.builtin", { link = "Special" })
hi("@function.macro", { link = "Macro" })
hi("@function.method", { link = "Function" })
hi("@variable.parameter", { link = "Identifier" })
hi("@variable.parameter.builtin", { link = "Special" })
hi("@variable.member", { link = "Identifier" })
hi("@property", { link = "Identifier" })
hi("@attribute", { link = "Macro" })
hi("@attribute.builtin", { link = "Special" })
hi("@constructor", { link = "Special" })
-- Keywords
hi("@keyword.conditional", { link = "Conditional" })
hi("@keyword.repeat", { link = "Repeat" })
hi("@keyword.type", { link = "Structure" })
hi("@label", { link = "Label" })
hi("@operator", { link = "Operator" })
hi("@keyword", { link = "Keyword" })
hi("@keyword.exception", { link = "Exception" })
hi("@variable", { link = "Identifier" })
hi("@type", { link = "Type" })
hi("@type.builtin", { link = "Type" })
hi("@type.definition", { link = "Typedef" })
hi("@module", { link = "Identifier" })
hi("@keyword.import", { link = "Include" })
hi("@keyword.directive", { link = "PreProc" })
hi("@keyword.debug", { link = "Debug" })
hi("@tag", { link = "Tag" })
hi("@tag.tsx", { link = "Identifier" })
hi("@tag.builtin", { link = "Special" })
-- LSP semantic tokens
hi("@lsp.type.class", { link = "Structure" })
hi("@lsp.type.comment", { link = "Comment" })
hi("@lsp.type.decorator", { link = "Function" })
hi("@lsp.type.enum", { link = "Structure" })
hi("@lsp.type.enumMember", { link = "Constant" })
hi("@lsp.type.function", { link = "Function" })
hi("@lsp.type.interface", { link = "Structure" })
hi("@lsp.type.macro", { link = "Macro" })
hi("@lsp.type.method", { link = "Function" })
hi("@lsp.type.namespace", { link = "Structure" })
hi("@lsp.type.parameter", { link = "Identifier" })
hi("@lsp.type.property", { link = "Identifier" })
hi("@lsp.type.struct", { link = "Structure" })
hi("@lsp.type.type", { link = "Type" })
hi("@lsp.type.typeParameter", { link = "TypeDef" })
hi("@lsp.type.variable", { link = "Identifier" })
hi("@lsp.typemod.keyword.documentation", { fg = palette.grey, bold = true })
if vim.o.background == "light" then
-- TODO: Define light scheme
else
-- Default colors only used with a dark background.
hi("ColorColumn", { bg = palette.red_subtle_bg, ctermbg = "DarkRed" })
hi("CursorColumn", { bg = palette.grey, ctermbg = "DarkGrey" })
hi("CursorLine", { bg = palette.magenta_subtle_bg_darker, cterm = { underline = true } })
hi("CursorLineNr", {
fg = palette.fg,
bg = palette.magenta_subtle_bg_darker,
bold = true,
ctermfg = "White",
cterm = { underline = true },
})
hi("DiffAdd", { fg = palette.green_bright, bg = palette.green_subtle_bg, ctermbg = "DarkGreen" })
hi("DiffChange", { fg = palette.yellow_brighter, bg = palette.yellow_subtle_bg, ctermbg = "DarkYellow" })
hi("DiffDelete", { fg = palette.red_bright, bg = palette.red_subtle_bg, ctermbg = "DarkRed" })
hi("Directory", { fg = palette.magenta, bold = true, ctermfg = "Magenta" })
hi("FoldColumn", { fg = palette.cyan_bright, bg = palette.grey, ctermfg = "Cyan", ctermbg = "DarkGrey" })
hi("Folded", { fg = palette.cyan_bright, bg = palette.grey, ctermfg = "Cyan", ctermbg = "DarkGrey" })
hi("LineNr", { fg = palette.grey_bright, ctermfg = "Grey" })
hi(
"MatchParen",
{ fg = palette.fg_alt, bg = palette.magenta_subtle_bg, ctermbg = "DarkMagenta", ctermfg = "Black" }
)
hi("MoreMsg", { fg = palette.grey, ctermfg = "DarkGrey" })
hi("Pmenu", { bg = palette.bg_secondary, ctermfg = "White", ctermbg = "Black" })
hi("PmenuSel", {
bg = palette.magenta_subtle_bg,
fg = palette.fg,
bold = true,
ctermfg = "LightMagenta",
ctermbg = "DarkMagenta",
})
hi("PmenuThumb", { bg = palette.fg, ctermbg = "White" })
hi("Question", { fg = palette.green_bright, bold = true, ctermfg = "LightGreen" })
hi("Search", { link = "IncSearch" })
hi("Substitute", {
fg = palette.green_bright,
bg = palette.green_subtle_bg,
bold = true,
ctermfg = "DarkBlue",
ctermbg = "LightBlue",
})
hi("SignColumn", { fg = palette.grey_bright, bg = palette.bg, ctermfg = "Cyan", ctermbg = "DarkGrey" })
hi("SpecialKey", { fg = palette.cyan_bright, ctermfg = "LightBlue" })
hi("SpellBad", { fg = palette.red, undercurl = true, ctermbg = "Red" })
hi("SpellCap", { fg = palette.blue, undercurl = true, ctermbg = "Blue" })
hi("SpellLocal", { fg = palette.cyan, undercurl = true, ctermbg = "Cyan" })
hi("SpellRare", { fg = palette.magenta, undercurl = true, ctermbg = "Magenta" })
hi("StatusLineTerm", {
fg = palette.bg,
bg = palette.green_bright,
bold = true,
ctermfg = "Black",
ctermbg = "LightGreen",
cterm = { bold = true },
})
hi("StatusLineTermNC", { fg = palette.bg, bg = palette.green_bright, ctermfg = "Black", ctermbg = "LightGreen" })
hi(
"TabLine",
{ bg = palette.grey, underline = true, ctermfg = "White", ctermbg = "DarkGrey", cterm = { underline = true } }
)
hi("Title", { fg = palette.magenta_bright, bold = true, ctermfg = "Magenta" })
hi("Visual", {
fg = palette.magenta_brighter,
bg = palette.magenta_subtle_bg,
ctermfg = "LightMagenta",
ctermbg = "DarkMagenta",
})
hi("WarningMsg", { fg = palette.red_bright, ctermfg = "LightRed" })
hi("Comment", { fg = palette.grey, ctermfg = "Cyan" })
hi("Unused", { fg = palette.grey_bright, undercurl = true, ctermfg = "LightGrey" })
hi("Constant", { fg = palette.yellow_brighter, ctermfg = "LightYellow" })
hi("ConstantUnderlined", { fg = palette.yellow_brighter, underline = true, ctermfg = "LightYellow" })
hi("Special", { fg = palette.silver, ctermfg = "LightGrey" })
hi("Identifier", { fg = palette.fg, ctermfg = "White", cterm = { bold = true } })
hi("Statement", { fg = palette.fg_alt, bold = true, ctermfg = "White" })
hi("PreProc", { fg = palette.magenta, ctermfg = "LightMagenta" })
hi("Type", { fg = palette.silver, bold = true, ctermfg = "LightCyan" })
hi("Underlined", { fg = palette.silver, underline = true, ctermfg = "LightGrey", cterm = { underline = true } })
hi("Ignore", { fg = palette.bg, ctermfg = "Black" })
hi(
"Added",
{ fg = palette.green_bright, bg = palette.green_subtle_bg, ctermfg = "LightGreen", ctermbg = "DarkGreen" }
)
hi(
"Changed",
{ fg = palette.blue_bright, bg = palette.blue_subtle_bg, ctermfg = "LightBlue", ctermbg = "DarkBlue" }
)
hi("Removed", { fg = palette.red_bright, bg = palette.red_subtle_bg, ctermfg = "LightRed", ctermbg = "DarkRed" })
hi("NotificationInfo", { fg = palette.silver, bg = palette.bg, ctermfg = "White", ctermbg = "Black" })
-- Snacks
hi("SnacksIndentScope", { fg = palette.magenta, ctermfg = "LightGrey" })
hi("SnacksIndent", { fg = palette.magenta_subtle_bg, ctermfg = "DarkGrey" })
hi(
"SnacksPickerCursorLine",
{ bg = palette.magenta_subtle_bg, fg = palette.fg, bold = true, cterm = { underline = true } }
)
hi("SnacksPickerListCursorLine", { link = "SnacksPickerCursorLine" })
hi("SnacksPickerTitle", { link = "FloatTitle" })
hi("SnacksBackdrop", { link = "Pmenu" })
-- Flash
hi("FlashMatch", { reverse = true })
hi("FlashLabel", { bg = palette.fg, fg = palette.bg })
-- FzfLua
hi("FzfLuaNormal", { link = "Pmenu" })
hi("FzfLuaBorder", { link = "Pmenu" })
hi("FzfLuaTitle", { link = "Pmenu" })
hi("FzfLuaBackdrop", { link = "Pmenu" })
hi("FzfLuaPreviewNormal", { link = "FzfLuaNormal" })
hi("FzfLuaPreviewBorder", { link = "FzfLuaBorder" })
hi("FzfLuaPreviewTitle", { link = "FzfLuaTitle" })
hi(
"FzfLuaCursorLine",
{ bg = palette.magenta_subtle_bg, fg = palette.fg, bold = true, cterm = { underline = true } }
)
hi("FzfLuaTitleFlags", { link = "FzfLuaCursorLine" })
hi("FzfLuaCursorLineNr", { link = "FzfLuaCursorLine" })
hi("FzfLuaHeaderBind", { link = "Pmenu" })
hi("FzfLuaHeaderText", { link = "Comment" })
hi("FzfLuaPathLineNr", { link = "Pmenu" })
hi("FzfLuaPathColNr", { link = "Pmenu" })
hi("FzfLuaLivePrompt", { link = "Pmenu" })
hi("FzfLuaCmdBuf", { link = "Comment" })
hi("FzfLuaBufName", { link = "Pmenu" })
hi("FzfLuaBufId", { link = "Special" })
hi("FzfLuaBufLineNr", { link = "Special" })
hi("FzfLuaBufFlagCur", { link = "Pmenu" })
hi("FzfLuaBufFlagAlt", { link = "Comment" })
-- Blinkpairs
hi("BlinkPairsOrange", { link = "Comment" })
hi("BlinkPairsPurple", { fg = palette.magenta_brighter })
hi("BlinkPairsBlue", { fg = palette.magenta_bright })
-- Neogit
hi("NeogitDiffAdd", { link = "DiffAdd" })
hi("NeogitDiffDelete", { link = "DiffDelete" })
hi("NeogitDiffContext", { bg = palette.bg_secondary, fg = palette.fg })
hi("NeogitDiffContextCursor", { bg = palette.magenta_subtle_bg_darker, fg = palette.magenta_brighter })
hi("NeogitDiffAddCursor", { bg = palette.green_bright, fg = palette.green_subtle_bg })
hi("NeogitDiffDeleteCursor", { bg = palette.red_bright, fg = palette.red_subtle_bg })
hi("NeogitDiffContextHighlight", { link = "NeogitDiffContext" })
hi("NeogitDiffAddHighlight", { link = "DiffAdd" })
hi("NeogitDiffDeleteHighlight", { link = "DiffDelete" })
hi("NeogitHunkHeader", { bg = palette.bg_secondary, fg = palette.grey_bright })
hi("NeogitHunkMergeHeader", { link = "NeogitHunkHeader" })
hi("NeogitHunkHeaderHighlight", { bg = palette.magenta_subtle_bg, fg = palette.magenta_brighter })
hi("NeogitHunkHeaderCursor", { link = "NeogitHunkHeaderHighlight" })
hi("NeogitCommitViewHeader", { bg = palette.bg_secondary, fg = palette.fg })
hi("NeogitDiffHeader", { bg = palette.bg, fg = palette.grey_bright, bold = true })
hi("NeogitActiveItem", { bg = palette.grey_bright, fg = palette.bg, bold = true })
end

View file

@ -0,0 +1,56 @@
{ pkgs, ... }:
{
plugins.conform-nvim = {
enable = true;
settings = {
formatters_by_ft = {
typescriptreact = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
astro = [ "prettierd" ];
typescript = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
javascript = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
javascriptreact = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
html = [ "prettierd" ];
htmlangular = [ "prettierd" ];
css = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
yaml = [ "prettierd" ];
markdown = [ "prettierd" ];
json = {
__unkeyed-1 = "biome-check";
__unkeyed-2 = "prettierd";
stop_after_first = true;
};
lua = [ "stylua" ];
go = [ "goimports" ];
gomod = [ "goimports" ];
gowork = [ "goimports" ];
gotmpl = [ "goimports" ];
};
format_on_save = {
timeout_ms = 500;
lsp_format = "fallback";
};
};
extraPackages = [pkgs.stylua];
};
}

28
modules/nixvim/git.nix Normal file
View file

@ -0,0 +1,28 @@
{
plugins.gitportal = {
enable = true;
};
keymaps = [
{
key = "<leader>gll";
action = "<cmd>GitPortal<cr>";
options.desc = "Open line in Git provider";
}
{
key = "<leader>gll";
action = "<cmd>GitPortal<cr>";
options.desc = "Open line in Git provider";
}
{
key = "<leader>gly";
action = "<cmd>GitPortal copy_link_to_clipboard<cr>";
options.desc = "Copy link to line at Git provider";
}
{
key = "<leader>glo";
action = "<cmd>GitPortal open_link<cr>";
options.desc = "Open link to line at Git provider";
}
];
}

View file

@ -0,0 +1,138 @@
{
plugins.which-key.enable = true;
keymaps = [
# Open
{
mode = [ "n" ];
key = "<leader>od";
action = "<cmd>vsplit | lua vim.lsp.buf.definition()<cr>";
options.desc = "Go to definition in other window";
}
# Buffer
{
mode = [ "n" ];
key = "<leader>bn";
action = "<cmd>bn<cr>";
options.desc = "Move to next buffer";
}
{
mode = [ "n" ];
key = "<leader>bp";
action = "<cmd>bp<cr>";
options.desc = "Move to previous buffer";
}
{
mode = [ "n" ];
key = "<leader>bk";
action = "<cmd>bn<cr>";
options.desc = "Kill buffer and window";
}
# File
{
mode = [ "n" ];
key = "<leader>fn";
action = "<cmd>enew<cr>";
options.desc = "Create a new file";
}
{
mode = [ "n" ];
key = "<leader>fs";
action = "<cmd>w<cr>";
options.desc = "Save currently opened file";
}
# Quit
{
mode = [ "n" ];
key = "<leader>qq";
action = "<cmd>qa!<cr>";
options.desc = "Leave neovim";
}
# Diagnostics
{
mode = [ "n" ];
key = "<leader>ta";
action = "<cmd>TodoQuickFix<cr>";
options.desc = "Show all todo comments";
}
# Window
{
mode = [ "n" ];
key = "<leader>w+";
action = ":vertical resize +4<cr>";
options.desc = "Increase window size";
}
{
mode = [ "n" ];
key = "<leader>w-";
action = ":vertical resize -4<cr>";
options.desc = "Decrease window size";
}
{
mode = [ "n" ];
key = "<leader>wx";
action = ":bd<cr>";
options.desc = "Kill active window and buffer";
}
{
mode = [ "n" ];
key = "<leader>wh";
action = "<C-W>h";
options.desc = "Move to window on left";
}
{
mode = [ "n" ];
key = "<leader>wj";
action = "<C-W>j";
options.desc = "Move to window on bottom";
}
{
mode = [ "n" ];
key = "<leader>wk";
action = "<C-W>k";
options.desc = "Move to window on top";
}
{
mode = [ "n" ];
key = "<leader>wl";
action = "<C-W>l";
options.desc = "Move to window on right";
}
{
mode = [ "n" ];
key = "<leader>ws";
action = "<cmd>sp<cr>";
options.desc = "Split windows horizontally";
}
{
mode = [ "n" ];
key = "<leader>wv";
action = "<cmd>vsp<cr>";
options.desc = "Split windows vertically";
}
{
mode = [ "n" ];
key = "<leader>wd";
action = "<cmd>close<cr>";
options.desc = "Delete window only";
}
# Config
{
mode = [ "n" ];
key = "<leader>xn";
action = "<cmd>set number relativenumber<cr>";
options.desc = "Show relative numbers";
}
{
mode = [ "n" ];
key = "<leader>xr";
action = "<cmd>source $MYVIMRC<cr>";
options.desc = "Reload config";
}
];
}

67
modules/nixvim/lsp.nix Normal file
View file

@ -0,0 +1,67 @@
{ pkgs, ... }:
{
plugins.lspconfig.enable = true;
lsp = {
enable = true;
servers = {
lua_ls = {
enable = true;
package = pkgs.lua-language-server;
packageFallback = true;
};
nil_ls = {
enable = true;
package = pkgs.nil;
packageFallback = true;
};
ts_ls = {
enable = true;
package = pkgs.typescript-language-server;
packageFallback = true;
};
jsonls = {
enable = true;
package = pkgs.vscode-langservers-extracted;
packageFallback = true;
};
astro = {
enable = true;
package = pkgs.astro-language-server;
packageFallback = true;
};
eslint = {
enable = true;
package = pkgs.vscode-langservers-extracted;
packageFallback = true;
};
biome = {
enable = true;
package = pkgs.biome;
packageFallback = true;
};
};
keymaps = [
{
key = "<leader>ca";
lspBufAction = "code_action";
}
{
key = "<leader>e";
action = "<cmd>lua vim.diagnostic.open_float()<cr>";
}
];
};
# Define diagnostic appearance
diagnostic.settings = {
virtual_text = false;
signs = true;
underline = true;
update_in_insert = false;
severity_sort = false;
};
}

View file

@ -0,0 +1,47 @@
{
globals = {
mapleader = " ";
maplocalleader = " ";
};
clipboard.register = "unnamedplus";
opts = {
backup = false;
cmdheight = 1;
conceallevel = 0;
fileencoding = "utf-8";
hlsearch = true;
ignorecase = true;
mouse = "a";
pumheight = 10;
showmode = false;
smartindent = true;
breakindent = true;
showtabline = 0;
smartcase = true;
splitbelow = true;
splitright = true;
swapfile = false;
termguicolors = true;
timeoutlen = 600;
undofile = true;
updatetime = 230;
writebackup = false;
expandtab = true;
shiftwidth = 2;
tabstop = 2;
cursorline = true;
number = true;
relativenumber = true;
numberwidth = 2;
signcolumn = "yes";
linebreak = true;
breakat = " ^I!@*-+;:,./?";
scrolloff = 4;
sidescrolloff = 4;
winbar = "";
foldlevel = 99;
foldlevelstart = 99;
};
}

171
modules/nixvim/picker.nix Normal file
View file

@ -0,0 +1,171 @@
{ pkgs, ... }:
{
plugins.oil = {
enable = true;
settings = {
keymaps = {
"q" = "actions.close";
};
columns = [
"icon"
"permissions"
"size"
"mtime"
];
};
};
extraPlugins = [ pkgs.vimPlugins.snacks-nvim ];
extraConfigLua = /* lua */ ''
local Snacks = require("snacks");
local filter_lsp_definitions = function(item)
if item.file:match("/react/ts5.0/") or item.file:match("react.d.ts") then
return false
end
return true
end
Snacks.setup({
bigfile = { enabled = true },
bufdelete = { enabled = true },
git = { enabled = true },
indent = { enabled = true },
input = { enabled = true },
notifier = { enabled = true },
picker = {
enabled = true,
prompt = "λ ",
layout = { preset = "ivy" },
},
statuscolumn = { enabled = true },
})
'';
keymaps = [
# Git
{
key = "<leader>gb";
action.__raw = "function() Snacks.git.blame_line() end";
options.desc = "Show git blame for current line";
}
# Picker
{
key = "<leader>.";
action.__raw = "function() Snacks.picker.files({ hidden = true }) end";
options.desc = "Files";
}
{
key = "<leader><leader>";
action.__raw = "function() Snacks.picker.git_files() end";
options.desc = "Git files";
}
# Find
{
key = "<leader>fr";
action.__raw = "function() Snacks.picker.recent() end";
options.desc = "Recent";
}
{
key = "<leader>fp";
action.__raw = "function() Snacks.picker.projects() end";
options.desc = "Projects";
}
{
key = "<leader>bb";
action.__raw = "function() Snacks.picker.buffers() end";
options.desc = "List buffers";
}
{
key = "<leader>bd";
action.__raw = "function() Snacks.bufdelete() end";
options.desc = "Delete buffer";
}
{
key = "<leader>bD";
action.__raw = "function() Snacks.bufdelete.all() end";
options.desc = "Delete all buffers";
}
{
key = "<leader>bo";
action.__raw = "function() Snacks.bufdelete.other() end";
options.desc = "Delete other buffers";
}
# Search
{
key = "<leader>ss";
action.__raw = "function() Snacks.picker.grep() end";
options.desc = "Grep";
}
{
mode = [
"n"
"x"
];
key = "<leader>sw";
action.__raw = "function() Snacks.picker.grep_word() end";
options.desc = "Visual selection or word";
}
{
key = "<leader>su";
action.__raw = "function() Snacks.picker.undo() end";
options.desc = "Undo History";
}
# Diagnostics
{
key = "<leader>td";
action.__raw = "function() Snacks.picker.diagnostics_buffer() end";
options.desc = "Buffer Diagnostics";
}
{
key = "<leader>ta";
action.__raw = "function() Snacks.picker.diagnostics() end";
options.desc = "Diagnostics";
}
# LSP
{
key = "gd";
action.__raw = "function() Snacks.picker.lsp_definitions({ filter = { filter = filter_lsp_definitions } }) end";
options.desc = "Goto Definition";
}
{
key = "gD";
action.__raw = "function() Snacks.picker.lsp_declarations() end";
options.desc = "Goto Declaration";
}
{
key = "grr";
action.__raw = "function() Snacks.picker.lsp_references() end";
options = {
desc = "References";
nowait = true;
};
}
{
key = "gI";
action.__raw = "function() Snacks.picker.lsp_implementations() end";
options.desc = "Goto Implementation";
}
{
key = "gy";
action.__raw = "function() Snacks.picker.lsp_type_definitions() end";
options.desc = "Goto T[y]pe Definition";
}
# Notifications and highlights
{
key = "<leader>on";
action.__raw = "function() Snacks.notifier.show_history() end";
options.desc = "Open notification history";
}
{
key = "<leader>oh";
action.__raw = "function() Snacks.picker.highlights() end";
options.desc = "List highlights";
}
{
key = "<leader>n";
action = "<cmd>Oil<cr>";
options.desc = "Opens file explorer";
}
];
}

View file

@ -0,0 +1,97 @@
{
plugins.lualine = {
enable = true;
settings = {
options = {
theme = {
__raw = "winterly_lualine";
};
icons_enabled = false;
component_separators = {
left = "|";
right = "|";
};
section_separators = {
left = "";
right = "";
};
};
sections = {
lualine_a = [
{
__unkeyed-1 = "mode";
fmt = {
__raw = "function(str) return str:sub(1, 1) end";
};
}
];
};
lualine_b = [
{
__unkeyed-1 = "filename";
file_status = true;
newfile_status = false;
path = 1;
shorting_target = 120;
symbols = {
modified = "[+]";
readonly = "[-]";
unnamed = "[No Name]";
newfile = "[New]";
};
}
"encoding"
];
lualine_c = [ ];
lualine_x = [ ];
lualine_y = [
"branch"
"diff"
"diagnostics"
];
lualine_z = [
"location"
"progress"
];
};
# Sets up my custom colorscheme
luaConfig.pre = /* lua */ ''
local palette = require("dnsc.palette")
local winterly_lualine = {
normal = {
a = { bg = palette.magenta, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.magenta },
c = { bg = palette.bg_secondary, fg = palette.magenta },
},
insert = {
a = { bg = palette.cyan_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.cyan_bright },
c = { bg = palette.bg_secondary, fg = palette.cyan_bright },
},
visual = {
a = { bg = palette.blue_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.blue_bright },
c = { bg = palette.bg_secondary, fg = palette.blue_bright },
},
replace = {
a = { bg = palette.red_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.red_bright },
c = { bg = palette.bg_secondary, fg = palette.red_bright },
},
command = {
a = { bg = palette.green_bright, fg = palette.bg, gui = "bold" },
b = { bg = palette.bg_secondary, fg = palette.green_bright },
c = { bg = palette.bg_secondary, fg = palette.green_bright },
},
inactive = {
a = { bg = palette.bg_secondary, fg = palette.fg_dim },
b = { bg = palette.bg_secondary, fg = palette.fg_dim },
c = { bg = palette.bg_secondary, fg = palette.fg_dim },
},
}
'';
};
}

View file

@ -66,6 +66,9 @@
unbind s
bind s display-popup -h 50% -w 80% -E sessionizer
unbind g
bind g display-popup -h 90% -w 95% -E lazygit
unbind C-x
bind C-x kill-session