Modularize nixvim config

This commit is contained in:
2025-07-06 22:46:23 +02:00
parent 4131b9b116
commit 407f943102
10 changed files with 166 additions and 129 deletions
+1 -1
View File
@@ -2,6 +2,6 @@
imports = [
./git.nix
./fish.nix
./nixvim.nix
./nixvim
];
}
-128
View File
@@ -1,128 +0,0 @@
{ pkgs, ... }: {
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
colorschemes.tokyonight.enable = true;
globals.mapleader = " ";
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;
};
keymaps = [
{
mode = "n";
key = "<Esc>";
action = "<cmd>nohlsearch<CR>";
options.silent = true;
}
{
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";
}
];
plugins.lz-n.enable = true;
plugins.nvim-autopairs = {
enable = true;
lazyLoad = {
enable = true;
settings.event = "InsertEnter";
};
};
plugins.indent-blankline.enable = true;
plugins.lualine = {
enable = true;
settings = {
options = { section_separators = ""; component_separators = ""; };
sections = {
lualine_b = [ { __unkeyed-1 = "branch"; icon = ""; } ];
lualine_c = [ "filename" ];
lualine_x = [ "filetype" ];
};
};
};
plugins.treesitter = {
enable = true;
settings = {
auto_install = true;
highlight.enable = true;
indent.enable = true;
};
};
plugins.which-key = {
enable = true;
lazyLoad = {
enable = true;
settings.event = "VimEnter";
};
};
extraPackages = with pkgs; [
gcc
];
extraPlugins = with pkgs.vimPlugins; [
vim-sleuth
];
};
}
+19
View File
@@ -0,0 +1,19 @@
{
imports = [
./opts.nix
./keymaps.nix
./plugins
];
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
defaultEditor = true;
colorschemes.tokyonight.enable = true;
globals.mapleader = " ";
};
}
+35
View File
@@ -0,0 +1,35 @@
{
programs.nixvim.keymaps = [
{
mode = "n";
key = "<Esc>";
action = "<cmd>nohlsearch<CR>";
options.silent = true;
}
{
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;
};
}
@@ -0,0 +1,19 @@
{ pkgs, ... }: {
imports = [
./treesitter.nix
./lualine.nix
./nvim-autopairs.nix
./which-key.nix
];
programs.nixvim = {
plugins = {
lz-n.enable = true;
indent-blankline.enable = true;
};
extraPlugins = with pkgs.vimPlugins; [
vim-sleuth
];
};
}
@@ -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,16 @@
{ 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";
};
};
}