refactor(config): auto-import config files

This commit is contained in:
Nicolas Goudry 2024-05-27 09:39:25 +02:00
parent 1c12503ebf
commit 465916d5c1
No known key found for this signature in database
GPG key ID: 5FC434D9FFD1DF44
5 changed files with 126 additions and 109 deletions

View file

@ -1,5 +1,5 @@
# Use catppuccin mocha variant
{ {
colorschemes = {
catppuccin = { catppuccin = {
enable = true; enable = true;
@ -10,4 +10,5 @@
transparent_background = true; transparent_background = true;
}; };
}; };
};
} }

13
config/default.nix Normal file
View file

@ -0,0 +1,13 @@
{ lib, ... }@args:
let
definitions = lib.attrNames (
lib.filterAttrs
(filename: kind:
filename != "default.nix"
&& (kind == "regular" || kind == "directory")
)
(builtins.readDir ./.)
);
in
lib.mkMerge (map (file: import ./${file}) definitions)

View file

@ -4,7 +4,8 @@ let
options.desc = "Force write"; options.desc = "Force write";
}; };
in in
[ {
keymaps = [
{ {
key = "<leader>n"; key = "<leader>n";
action = "<cmd>enew<cr>"; action = "<cmd>enew<cr>";
@ -30,4 +31,5 @@ in
action = "<cmd>split<cr>"; action = "<cmd>split<cr>";
options.desc = "Split horizontally"; options.desc = "Split horizontally";
} }
] ];
}

View file

@ -2,6 +2,7 @@
# Use :options to get the list of all options # Use :options to get the list of all options
# Use :h <option> to load help for given <option> # Use :h <option> to load help for given <option>
{ {
opts = {
# Hide command line unless needed # Hide command line unless needed
cmdheight = 0; cmdheight = 0;
@ -100,4 +101,5 @@
# Disable line wrapping # Disable line wrapping
wrap = false; wrap = false;
};
} }

View file

@ -1,13 +1,12 @@
{ pkgs, ... }: _:
{ {
imports = [ ./plugins ]; imports = [
./config
./plugins
];
config = { config = {
colorschemes = import ./config/colorscheme.nix;
keymaps = import ./config/keymaps.nix;
opts = import ./config/options.nix;
# Needed for telescope live grep # Needed for telescope live grep
extraPackages = [ pkgs.ripgrep ]; extraPackages = [ pkgs.ripgrep ];