Nvim: Refactor a bit.

This commit is contained in:
Dmitry Voronin 2024-12-23 08:29:17 +03:00
parent 4bc0b2b0a2
commit 43c157581c
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k
2 changed files with 96 additions and 96 deletions

View file

@ -33,7 +33,7 @@ in
".config/fuzzel/fuzzel.ini".source = fuzzel.file;
".config/keyd/app.conf".text = keyd.text;
".config/mako/config".source = mako.file;
".config/nvim/init.vim".text = nvim.text;
".config/nvim/init.vim".source = nvim.init;
".config/swappy/config".source = swappy.config;
".config/sway/config".text = sway.text;
".config/tmux/tmux.conf".source = tmux.config;

View file

@ -6,37 +6,7 @@
...
}:
let
nvimRc =
{ runtimes, configs }:
let
accent = config.module.style.color.accent;
bg = config.module.style.color.bg.regular;
fg = config.module.style.color.fg.dark;
ollamaModel = config.module.ollama.primaryModel;
selection = config.module.style.color.selection;
# Plugin paths to install.
runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes;
# My configuration files combined into one big file.
cfgRaw = pkgs.writeText "nvim-rc-raw" (util.readFiles configs);
cfg = pkgs.replaceVars cfgRaw {
inherit
accent
bg
fg
ollamaModel
selection
;
};
# Tell Neovim to load this file.
configRc = "lua dofile(\"${cfg}\")";
in
runtimeRc + configRc;
in
{
text = nvimRc {
# Directories for nvim to use.
runtimes = [
"~/.cache/nvim"
"~/.cache/nvim/treesitter"
@ -60,6 +30,7 @@ in
"${inputs.nvimTrouble}"
];
# Order of files to load.
configs = [
./module/key/Rekey.lua
./module/key/Leader.lua
@ -105,5 +76,34 @@ in
./module/key/Terminal.lua
./module/key/Trouble.lua
];
# Configuration.
accent = config.module.style.color.accent;
bg = config.module.style.color.bg.regular;
fg = config.module.style.color.fg.dark;
ollamaModel = config.module.ollama.primaryModel;
selection = config.module.style.color.selection;
# Plugin paths to install.
runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes;
# My configuration files combined into one big file.
cfgRaw = pkgs.writeText "nvim-rc-raw" (util.readFiles configs);
cfg = pkgs.replaceVars cfgRaw {
inherit
accent
bg
fg
ollamaModel
selection
;
};
# Tell Neovim to load this file.
configRc = "lua dofile(\"${cfg}\")";
init = pkgs.writeText "nvim-init" (runtimeRc + configRc);
in
{
inherit init;
}