refactor: biggest cleanup of my life

This commit is contained in:
2026-02-19 16:29:24 +01:00
parent 94dc0e0927
commit c15e65fece
35 changed files with 104 additions and 260 deletions
+34
View File
@@ -0,0 +1,34 @@
{
config,
lib,
...
}:
{
imports = [
./opts.nix
./keymaps.nix
./plugins
];
options.kekleo.neovim = lib.mkOption {
type = lib.types.bool;
default = true;
description = "Whether to enable neovim.";
};
config = lib.mkIf config.kekleo.neovim {
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
colorschemes.tokyonight.enable = true;
clipboard.providers.wl-copy.enable = true;
globals.mapleader = " ";
};
};
}
+42
View File
@@ -0,0 +1,42 @@
{
programs.nixvim.keymaps = [
{
mode = "n";
key = "<Esc>";
action = "<cmd>nohlsearch<CR>";
options.silent = true;
}
{
mode = "n";
key = "<leader>q";
action.__raw = "vim.diagnostic.setloclist";
options.desc = "Open diagnostics quickfix list";
}
{
mode = "n";
key = "<C-h>";
action = "<C-w><C-h>";
options.desc = "Move focus to the left window";
}
{
mode = "n";
key = "<C-l>";
action = "<C-w><C-l>";
options.desc = "Move focus to the right window";
}
{
mode = "n";
key = "<C-k>";
action = "<C-w><C-k>";
options.desc = "Move focus to the upper window";
}
{
mode = "n";
key = "<C-j>";
action = "<C-w><C-j>";
options.desc = "Move focus to the lower window";
}
];
}
+37
View File
@@ -0,0 +1,37 @@
{
programs.nixvim.opts = {
number = true;
relativenumber = true;
showmode = false;
breakindent = true;
undofile = true;
ignorecase = true;
smartcase = true;
signcolumn = "yes";
updatetime = 250;
timeoutlen = 300;
splitright = true;
splitbelow = true;
list = true;
listchars = {
tab = "» ";
trail = "·";
nbsp = "";
};
inccommand = "split";
cursorline = true;
scrolloff = 10;
confirm = true;
};
}
+68
View File
@@ -0,0 +1,68 @@
{
programs.nixvim = {
opts.completeopt = [
"menu"
"menuone"
"noselect"
];
plugins = {
lspkind = {
enable = true;
settings.mode = "symbol";
};
cmp = {
enable = true;
autoEnableSources = true;
settings = {
snippet.expand = "function(args) vim.snippet.expand(args.body) end";
formatting.fields = [
"abbr"
"kind"
"menu"
];
mapping = {
"<C-p>" = "cmp.mapping.select_prev_item()";
"<C-n>" = "cmp.mapping.select_next_item()";
"<C-b>" = "cmp.mapping.scroll_docs(-4)";
"<C-f>" = "cmp.mapping.scroll_docs(4)";
"<C-e>" = "cmp.mapping.close()";
"<C-y>" = "cmp.mapping.confirm({ select = true })";
"<CR>" = "cmp.mapping.confirm({ select = true })";
"<C-Space>" = "cmp.mapping.complete()";
"<C-l>" = ''
cmp.mapping(
function()
if vim.snippet.active({ direction = 1 }) then
vim.snippet.jump(1)
end
end,
{'i', 's'}
)
'';
"<C-h>" = ''
cmp.mapping(
function()
if vim.snippet.active({ direction = -1 }) then
vim.snippet.jump(-1)
end
end,
{'i', 's'}
)
'';
};
sources = [
{ name = "nvim_lsp"; }
{ name = "nvim_lsp_signature_help"; }
{ name = "path"; }
];
};
};
};
};
}
@@ -0,0 +1,25 @@
{ pkgs, ... }:
{
imports = [
./cmp.nix
./lsp.nix
./fmt.nix
./treesitter.nix
./telescope.nix
./lualine.nix
./nvim-autopairs.nix
./which-key.nix
];
programs.nixvim = {
plugins = {
lz-n.enable = true;
indent-blankline.enable = true;
web-devicons.enable = true;
};
extraPlugins = with pkgs.vimPlugins; [
vim-sleuth
];
};
}
+52
View File
@@ -0,0 +1,52 @@
{ pkgs, ... }:
{
programs.nixvim = {
opts.formatexpr = "v:lua.require'conform'.formatexpr()";
plugins.conform-nvim = {
enable = true;
lazyLoad.enable = true;
lazyLoad.settings = {
event = "BufWritePre";
cmd = "ConformInfo";
keys = [
{
__unkeyed-1 = "<leader>f";
__unkeyed-2.__raw = ''
function() require 'conform'.format { async = true } end
'';
desc = "Format Buffer";
}
];
};
settings = {
default_format_opts.lsp_format = "fallback";
format_on_save = ''
function(bufnr)
local disable_filetypes = { c = true, cpp = true }
local lsp_format_opt
if disable_filetypes[vim.bo[bufnr].filetype] then
lsp_format_opt = 'never'
else
lsp_format_opt = 'fallback'
end
return {
timeout_ms = 500,
lsp_format = lsp_format_opt,
}
end
'';
formatters_by_ft = {
lua = [ "stylua" ];
nix = [ "nixfmt" ];
};
};
};
extraPackages = with pkgs; [
stylua
nixfmt-rfc-style
];
};
}
+65
View File
@@ -0,0 +1,65 @@
{
programs.nixvim = {
diagnostic.settings = {
severity_sort = true;
float = {
border = "rounded";
source = "if_many";
};
signs.text.__raw = "{
[vim.diagnostic.severity.ERROR] = '󰅚 ',
[vim.diagnostic.severity.WARN] = '󰀪 ',
[vim.diagnostic.severity.INFO] = '󰋽 ',
[vim.diagnostic.severity.HINT] = '󰌶 ',
}";
virtual_text = {
source = "if_many";
spacing = 2;
format.__raw = "
function(diagnostic)
return diagnostic.message
end
";
};
};
plugins = {
lsp = {
enable = true;
keymaps = {
silent = true;
lspBuf = {
"gd" = "definition";
"gD" = "declaration";
"gr" = "references";
"gI" = "implementation";
"<leader>ca" = "code_action";
"<leader>D" = "type_definition";
"<leader>rn" = "rename";
};
};
servers = {
lua_ls.enable = true;
nil_ls.enable = true;
pyright.enable = true;
ts_ls.enable = true;
vue_ls.enable = true;
rust_analyzer = {
enable = true;
installCargo = false;
installRustc = false;
};
qmlls = {
enable = true;
cmd = [
"qmlls"
"-E"
];
};
};
};
};
};
}
@@ -0,0 +1,21 @@
{
programs.nixvim.plugins.lualine = {
enable = true;
settings = {
options = {
section_separators = "";
component_separators = "";
};
sections = {
lualine_b = [
{
__unkeyed-1 = "branch";
icon = "";
}
];
lualine_c = [ "filename" ];
lualine_x = [ "filetype" ];
};
};
};
}
@@ -0,0 +1,9 @@
{
programs.nixvim.plugins.nvim-autopairs = {
enable = true;
lazyLoad = {
enable = true;
settings.event = "InsertEnter";
};
};
}
@@ -0,0 +1,46 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [
ripgrep
];
programs.nixvim.plugins.telescope = {
enable = true;
extensions.fzf-native.enable = true;
keymaps = {
"<leader>sh" = {
action = "help_tags";
options.desc = "Search Help";
};
"<leader>sf" = {
action = "find_files";
options.desc = "Search Files";
};
"<leader>ss" = {
action = "builtin";
options.desc = "Search Select Telescope";
};
"<leader>sg" = {
action = "live_grep";
options.desc = "Search by Grep";
};
"<leader><leader>" = {
action = "buffers";
options.desc = "Find existing buffers";
};
"<leader>/" = {
action = "current_buffer_fuzzy_find";
options.desc = "Find in current buffer";
};
};
settings.defaults.file_ignore_patterns = [
"^.git/"
"^.mypy_cache/"
"^__pycache__/"
"^output/"
"^data/"
"^node_modules/"
"%.ipynb"
];
};
}
@@ -0,0 +1,17 @@
{ pkgs, ... }:
{
programs.nixvim = {
plugins.treesitter = {
enable = true;
settings = {
auto_install = true;
highlight.enable = true;
indent.enable = true;
};
};
extraPackages = with pkgs; [
gcc
];
};
}
@@ -0,0 +1,9 @@
{
programs.nixvim.plugins.which-key = {
enable = true;
lazyLoad = {
enable = true;
settings.event = "VimEnter";
};
};
}