This commit is contained in:
2026-02-11 11:04:59 +01:00
commit 50d930e1ff
31 changed files with 2249 additions and 0 deletions

147
home/neovim/alpha.nix Normal file
View File

@@ -0,0 +1,147 @@
{ pkgs, ... }: {
# Alpha: Start screen/dashboard for Neovim
# Shows a custom ASCII art header and quick action buttons on startup.
programs.nixvim.plugins.alpha = {
enable = true;
settings.layout = [
{
type = "padding";
val = 2;
}
{
type = "text";
val = [
""
""
""
""
""
""
""
""
""
""
""
""
""
""
""
""
""
""
""
];
opts = {
position = "center";
hl = "Type";
};
}
{
type = "padding";
val = 2;
}
{
type = "group";
val = [
{
type = "button";
val = "[+] New file";
on_press.__raw =
"function() vim.cmd[[ene]] vim.cmd[[startinsert]] end";
opts = {
keymap = [ "n" "e" ":ene <BAR> startinsert <CR>" { } ];
shortcut = "e";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = "[?] Find file";
on_press.__raw = "function() vim.cmd[[Telescope find_files]] end";
opts = {
keymap = [ "n" "f" ":Telescope find_files <CR>" { } ];
shortcut = "f";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = "[~] Recent files";
on_press.__raw = "function() vim.cmd[[Telescope oldfiles]] end";
opts = {
keymap = [ "n" "r" ":Telescope oldfiles <CR>" { } ];
shortcut = "r";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = "[Y] Yazi";
on_press.__raw = "function() require('yazi').yazi() end";
opts = {
keymap = [ "n" "y" ":Yazi<CR>" { } ];
shortcut = "y";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = "[A] Open Prompt";
#on_press.__raw = "function() require('yazi').yazi() end";
opts = {
keymap = [ "n" "a" ":AvanteChatNew<CR>" { } ];
shortcut = "a";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
{
type = "button";
val = "[X] Quit";
on_press.__raw = "function() vim.cmd[[qa]] end";
opts = {
keymap = [ "n" "q" ":qa<CR>" { } ];
shortcut = "q";
position = "center";
cursor = 3;
width = 50;
align_shortcut = "right";
hl_shortcut = "Keyword";
};
}
];
}
{
type = "padding";
val = 2;
}
{
type = "text";
val = "Circuits hum in anticipation of your will.";
opts = {
position = "center";
hl = "Comment";
};
}
];
};
}

106
home/neovim/avante.nix Normal file
View File

@@ -0,0 +1,106 @@
{ pkgs, ... }: {
# Avante: AI-powered coding assistant (Cursor-like experience in Neovim)
programs.nixvim = {
plugins = {
markdown-preview.enable = true;
render-markdown.enable = true;
#extraConfigLuaPre = ''
# vim.env.GROQ_API_KEY = os.getenv("GROQ_API_KEY")
#'';
# TODO: Integrate CoPilot https://github.com/settings/copilot/features
avante = {
enable = true;
autoLoad = true;
settings = {
provider = "groq";
providers.groq = {
__inherited_from = "openai";
api_key_name = "GROQ_API_KEY";
endpoint = "https://api.groq.com/openai/v1/";
model = "groq/compound-mini";
disable_tools = true;
extra_request_body = {
temperature = 1;
max_tokens = 8192;
tools = null;
tool_choice = "none";
};
};
# auto_suggestions_provider = "copilot";
render = { markdown = true; };
behaviour = {
auto_suggestions = false;
auto_set_highlight_group = true;
auto_set_keymaps = true;
auto_apply_diff_after_generation = false;
support_paste_from_clipboard = false;
};
mappings = {
ask = "<leader>aa";
edit = "<leader>ae";
refresh = "<leader>ar";
diff = {
ours = "co";
theirs = "ct";
all_theirs = "ca";
both = "cb";
cursor = "cc";
next = "]x";
prev = "[x";
};
suggestion = {
accept = "<M-l>";
next = "<M-]>";
prev = "<M-[>";
dismiss = "<C-]>";
};
jump = {
next = "]]";
prev = "[[";
};
submit = {
normal = "<CR>";
insert = "<C-s>";
};
sidebar = {
switch_windows = "<Tab>";
reverse_switch_windows = "<S-Tab>";
};
};
hints = { enabled = true; };
windows = {
position = "right";
wrap = true;
width = 30;
sidebar_header = {
align = "center";
rounded = true;
};
};
highlights = {
diff = {
current = "DiffText";
incoming = "DiffAdd";
};
};
diff = {
autojump = true;
list_opener = "copen";
};
};
};
extraPackages = with pkgs; [ curl ];
};
};
}

View File

@@ -0,0 +1,34 @@
{ pkgs, ... }:
{
# Catppuccin: Soothing pastel theme for Neovim
# Provides consistent theming across plugins with transparency support.
programs.nixvim = {
colorschemes.catppuccin = {
enable = true;
settings = {
flavour = "mocha";
transparent_background = true;
term_colors = true;
integrations = {
treesitter = true;
cmp = true;
gitsigns = true;
telescope = {
enabled = true;
};
notify = true;
mini = {
enabled = true;
};
};
};
};
# Custom highlight overrides
extraConfigLua = ''
local colors = require("catppuccin.palettes").get_palette("mocha")
vim.api.nvim_set_hl(0, "LineNr", { fg = colors.text, bg = "NONE" })
vim.api.nvim_set_hl(0, "CursorLineNr", { fg = colors.pink, bg = "NONE", bold = true })
'';
};
}

33
home/neovim/conform.nix Normal file
View File

@@ -0,0 +1,33 @@
{ pkgs, ... }: {
# Conform: Code formatter that runs external formatting tools
# Automatically formats code on save for consistent style.
programs.nixvim = {
plugins.conform-nvim = {
enable = true;
settings = {
formatters_by_ft = {
lua = [ "stylua" ];
nix = [ "nixfmt" ];
python = [ "black" ];
rust = [ "rustfmt" ];
rasi = [ "prettierd" ];
};
format_on_save = {
timeout_ms = 2000;
lsp_fallback = true;
};
};
};
# Install formatters
extraPackages = with pkgs; [
stylua
nixfmt
black
rustfmt
prettierd
];
};
}

94
home/neovim/default.nix Normal file
View File

@@ -0,0 +1,94 @@
{ ... }: {
imports = [
./treesitter.nix
./lint.nix
./lsp.nix
./conform.nix
./lualine.nix
./yazi.nix
./toggleterm.nix
./telescope.nix
./catppuccin.nix
./alpha.nix
./avante.nix
./openscad.nix
./molten.nix
./which-key.nix
];
programs.nixvim = {
enable = true;
defaultEditor = true;
# Leader key
globals.mapleader = " ";
plugins.web-devicons.enable = true;
opts = {
number = true; # Show line numbers
cursorline = true; # Highlight current line
showmode = true; # already in statusline
hlsearch = true; # Highlight search result
incsearch = true; # Incremental Search
tabstop = 4;
termguicolors = true; # Enable 24-bit colormode
};
# Clipboard keymaps - yank to system clipboard
keymaps = [
# Yank operations
{
mode = "n";
key = "y";
action = ''"+y'';
options.desc = "Yank to clipboard";
}
{
mode = "v";
key = "y";
action = ''"+y'';
options.desc = "Yank to clipboard";
}
{
mode = "n";
key = "Y";
action = ''"+Y'';
options.desc = "Yank line to clipboard";
}
# Delete operations
{
mode = "n";
key = "d";
action = ''"+d'';
options.desc = "Delete to clipboard";
}
{
mode = "v";
key = "d";
action = ''"+d'';
options.desc = "Delete to clipboard";
}
{
mode = "n";
key = "D";
action = ''"+D'';
options.desc = "Delete line to clipboard";
}
# Paste operations
{
mode = "n";
key = "p";
action = ''"+p'';
options.desc = "Paste from clipboard";
}
{
mode = "v";
key = "p";
action = ''"+p'';
options.desc = "Paste from clipboard";
}
];
};
}

42
home/neovim/lint.nix Normal file
View File

@@ -0,0 +1,42 @@
{ pkgs, ... }:
{
# nvim-lint: Asynchronous linter that runs external linting tools
# to find errors and style issues without blocking the editor.
# Runs automatically after saving files.
programs.nixvim = {
plugins.lint = {
enable = true;
# Configure linters for each filetype
lintersByFt = {
lua = [ "luacheck" ];
nix = [ "statix" ]; # Nix static analyzer
python = [ "ruff" ];
javascript = [ "eslint" ];
rust = [ "clippy" ];
# rasi has no common linter
};
# Trigger linting after saving a file
autoCmd = {
event = [ "BufWritePost" ];
callback = {
__raw = ''
function()
require('lint').try_lint()
end
'';
};
};
};
# Install linter binaries
extraPackages = with pkgs; [
lua54Packages.luacheck
statix
ruff
nodePackages.eslint
clippy
];
};
}

91
home/neovim/lsp.nix Normal file
View File

@@ -0,0 +1,91 @@
{ pkgs, ... }:
{
# LSP configuration: Language Server Protocol provides IDE features
# like autocomplete, go-to-definition, diagnostics, and more.
programs.nixvim = {
plugins = {
# LSP configuration
lsp = {
enable = true;
# Language servers for each language
servers = {
lua_ls = {
enable = true;
settings = {
Lua = {
runtime.version = "LuaJIT";
diagnostics.globals = [ "vim" ];
workspace.library = [ ]; # Populated by nixvim
telemetry.enable = false;
};
};
};
nil_ls.enable = true; # Nix language server
rust_analyzer = {
enable = true; # Rust language server
installCargo = true;
installRustc = true;
};
pylsp.enable = true; # Python language server
};
# Keymaps for LSP actions
keymaps = {
diagnostic = {
"<leader>e" = "open_float";
"[d" = "goto_prev";
"]d" = "goto_next";
};
lspBuf = {
"gd" = "definition";
"K" = "hover";
"<leader>rn" = "rename";
"<leader>ca" = "code_action";
};
};
};
# Autocompletion
cmp = {
enable = true;
autoEnableSources = true;
settings = {
snippet.expand = ''
function(args)
require('luasnip').lsp_expand(args.body)
end
'';
mapping = {
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-Space>" = "cmp.mapping.complete()";
"<C-e>" = "cmp.mapping.abort()";
"<CR>" = "cmp.mapping.confirm({ select = true })";
};
sources = [
{ name = "nvim_lsp"; }
{ name = "luasnip"; }
{ name = "buffer"; }
{ name = "path"; }
];
};
};
# Snippet engine (required for completion)
luasnip.enable = true;
};
# Install LSP servers
extraPackages = with pkgs; [
lua-language-server
nil
rust-analyzer
python311Packages.python-lsp-server
];
};
}

22
home/neovim/lualine.nix Normal file
View File

@@ -0,0 +1,22 @@
{ pkgs, ... }:
{
# Lualine: Fast and customizable statusline for Neovim
# Displays file info, git status, diagnostics, and mode at the bottom of the editor.
programs.nixvim.plugins.lualine = {
enable = true;
settings = {
options = {
theme = "catppuccin";
component_separators = {
left = "|";
right = "|";
};
section_separators = {
left = "";
right = "";
};
};
};
};
}

43
home/neovim/molten.nix Normal file
View File

@@ -0,0 +1,43 @@
{ pkgs, ... }: {
programs.nixvim = {
plugins.molten = {
enable = true;
python3Dependencies = p:
with p; [
pynvim
jupyter-client
cairosvg
ipython
nbformat
ipykernel
pnglatex
plotly
kaleido
pyperclip
];
settings = {
kernel_name = "python3";
auto_open_output = true;
output_win_max_width = 80;
output_win_max_height = 20;
};
};
keymaps = [
{
mode = "n";
key = "<leader>ml";
action = "<cmd>MoltenEvaluateLine<CR>";
options.desc = "Molten: Evaluate line";
options.silent = true;
}
{
mode = "v";
key = "<leader>mv";
action = "<Cmd>MoltenEvaluateVisual<CR>";
options.desc = "Molten: Evaluate selection";
options.silent = true;
}
];
};
}

28
home/neovim/openscad.nix Normal file
View File

@@ -0,0 +1,28 @@
{ pkgs, ... }: {
# OpenSCAD: 3D modeling language support with syntax highlighting,
# cheatsheet, snippets, offline manual and fuzzy help
programs.nixvim = {
plugins.openscad = {
enable = true;
autoLoad = true;
settings = {
fuzzy_finder = "fzf";
auto_open = true;
cheatsheet_toggle_key = "<leader>os";
default_mappings = true;
exec_openscad_trig_key = "<leader>oo";
help_manual_trig_key = "<leader>om";
help_trig_key = "<leader>oh";
top_toggle = "<leader>oc";
};
};
# Install OpenSCAD binary for preview/compilation
extraPackages = with pkgs; [
openscad
zathura # PDF viewer for manual
fzf
];
};
}

27
home/neovim/telescope.nix Normal file
View File

@@ -0,0 +1,27 @@
{ pkgs, ... }:
{
# Telescope: Fuzzy finder for files, buffers, grep, and more
# Provides fast search and navigation throughout your project.
programs.nixvim.plugins.telescope = {
enable = true;
keymaps = {
"<leader>ff" = {
action = "find_files";
options.desc = "Telescope find files";
};
"<leader>fg" = {
action = "live_grep";
options.desc = "Telescope live grep";
};
"<leader>fb" = {
action = "buffers";
options.desc = "Telescope buffers";
};
"<leader>fh" = {
action = "help_tags";
options.desc = "Telescope help tags";
};
};
};
}

View File

@@ -0,0 +1,64 @@
{ pkgs, ... }:
{
# ToggleTerm: Terminal emulator inside Neovim
# Provides floating, horizontal, and vertical terminal windows.
programs.nixvim.plugins.toggleterm = {
enable = true;
settings = {
size = 20;
open_mapping = "[[<c-\\>]]";
direction = "float";
float_opts = {
border = "single";
width = 200;
height = 40;
};
};
};
programs.nixvim.keymaps = [
{
mode = "n";
key = "<leader>h";
action.__raw = ''
function()
require("toggleterm").toggle(1, 10, vim.loop.cwd(), "horizontal")
end
'';
options.desc = "Toggle terminal (horizontal)";
}
{
mode = "n";
key = "<leader>v";
action.__raw = ''
function()
require("toggleterm").toggle(2, 60, vim.loop.cwd(), "vertical")
end
'';
options.desc = "Toggle terminal (vertical)";
}
{
mode = "n";
key = "<leader>ft";
action.__raw = ''
function()
require("toggleterm").toggle(3, 20, vim.loop.cwd(), "float")
end
'';
options.desc = "Toggle terminal (float)";
}
{
mode = "t";
key = "<C-t>";
action = "<Cmd>ToggleTerm<CR>";
options.desc = "Toggle terminal";
}
{
mode = "t";
key = "<C-v>";
action = "<C-\\><C-n>v";
options.desc = "Exit terminal and enter visual mode";
}
];
}

View File

@@ -0,0 +1,24 @@
{ pkgs, ... }:
{
# Install language parsers declaratively
# Syntax Highlighting
programs.nixvim.plugins.treesitter = {
enable = true;
grammarPackages = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
lua
nix
python
javascript
rust
rasi
];
settings = {
highlight = {
enable = true;
additional_vim_regex_highlighting = false;
};
};
};
}

94
home/neovim/which-key.nix Normal file
View File

@@ -0,0 +1,94 @@
{ pkgs, ... }: {
# Which-key: Display available keybindings in popup
# Shows all possible key combinations after pressing leader or other prefix keys
programs.nixvim.plugins.which-key = {
enable = true;
settings = {
delay = 500; # Time in ms before popup shows
icons = {
breadcrumb = "»";
separator = "";
group = "+";
};
# Organize keymaps into named groups
spec = [
# Leader key groups
{
__unkeyed-1 = "<leader>a";
group = "Avante AI";
icon = "🤖";
}
{
__unkeyed-1 = "<leader>f";
group = "Find/Files/Terminal";
icon = "🔍";
}
{
__unkeyed-1 = "<leader>m";
group = "Molten (Jupyter)";
icon = "📓";
}
{
__unkeyed-1 = "<leader>o";
group = "OpenSCAD";
icon = "🔧";
}
# Bracket navigation groups
{
__unkeyed-1 = "[";
group = "Previous";
icon = "";
}
{
__unkeyed-1 = "]";
group = "Next";
icon = "";
}
# g prefix groups
{
__unkeyed-1 = "g";
group = "Go/LSP";
icon = "🎯";
}
{
__unkeyed-1 = "gr";
group = "LSP References/Rename";
icon = "🔗";
}
{
__unkeyed-1 = "gc";
group = "Comments";
icon = "💬";
}
# l prefix
{
__unkeyed-1 = "<leader>l";
group = "Live Server";
icon = "🌐";
}
# z prefix
{
__unkeyed-1 = "z";
group = "Folds/Spell";
icon = "📋";
}
];
# Hide specific mappings to reduce clutter
disable = {
builtin_keys = {
# Hide these default vim keys from which-key
i = [ "<C-R>" "<C-W>" ];
n = [ "<C-W>" ];
};
};
};
};
}

41
home/neovim/yazi.nix Normal file
View File

@@ -0,0 +1,41 @@
{ pkgs, ... }: {
# Yazi: Terminal file manager integration for Neovim
# Provides a fast, visual way to browse and manage files.
programs.nixvim = {
# Use extraPlugins to manually load yazi.nvim
extraPlugins = with pkgs.vimPlugins; [ yazi-nvim ];
# Configure yazi after it's loaded
extraConfigLua = ''
require('yazi').setup({
open_for_directories = true,
})
'';
keymaps = [
{
mode = "n";
key = "<leader>fy";
action.__raw = ''
function()
require('yazi').yazi(nil, vim.loop.cwd())
end
'';
options.desc = "Open Yazi file manager";
}
{
mode = "n";
key = "<leader>fd";
action.__raw = ''
function()
require('yazi').yazi(nil, vim.fn.expand("%:p:h"))
end
'';
options.desc = "Open Yazi in current file directory";
}
];
# Install yazi terminal program
extraPackages = with pkgs; [ yazi ];
};
}