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/fuzzel/fuzzel.ini".source = fuzzel.file;
".config/keyd/app.conf".text = keyd.text; ".config/keyd/app.conf".text = keyd.text;
".config/mako/config".source = mako.file; ".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/swappy/config".source = swappy.config;
".config/sway/config".text = sway.text; ".config/sway/config".text = sway.text;
".config/tmux/tmux.conf".source = tmux.config; ".config/tmux/tmux.conf".source = tmux.config;

View file

@ -6,104 +6,104 @@
... ...
}: }:
let let
nvimRc = # Directories for nvim to use.
{ runtimes, configs }: runtimes = [
let "~/.cache/nvim"
accent = config.module.style.color.accent; "~/.cache/nvim/treesitter"
bg = config.module.style.color.bg.regular; "${inputs.nvimAlign}"
fg = config.module.style.color.fg.dark; "${inputs.nvimAutoclose}"
ollamaModel = config.module.ollama.primaryModel; "${inputs.nvimBufferline}"
selection = config.module.style.color.selection; "${inputs.nvimCloseBuffers}"
"${inputs.nvimColorizer}"
"${inputs.nvimDevicons}"
"${inputs.nvimDressing}"
"${inputs.nvimGen}"
"${inputs.nvimGitsigns}"
"${inputs.nvimGruvboxMaterial}"
"${inputs.nvimIndentoMatic}"
"${inputs.nvimLspconfig}"
"${inputs.nvimPlenary}"
"${inputs.nvimTelescope}"
"${inputs.nvimTodo}"
"${inputs.nvimTreesitter}"
"${inputs.nvimTree}"
"${inputs.nvimTrouble}"
];
# Plugin paths to install. # Order of files to load.
runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes; configs = [
./module/key/Rekey.lua
./module/key/Leader.lua
./module/config/Autoread.lua
./module/config/Etc.lua
./module/config/Search.lua
./module/config/Tab.lua
./module/config/Highlight.lua
./module/plugin/Filetree.lua
./module/plugin/Gruvbox.lua
./module/plugin/Bufferline.lua
./module/plugin/Autoclose.lua
./module/plugin/Gitsigns.lua
./module/plugin/Trouble.lua
./module/plugin/Closebuffers.lua
./module/plugin/Telescope.lua
./module/plugin/Todo.lua
./module/plugin/Indent.lua
./module/plugin/Align.lua
./module/plugin/Treesitter.lua
./module/plugin/Fold.lua
./module/plugin/Gen.lua
./module/plugin/Colorizer.lua
./module/plugin/Dressing.lua
./module/plugin/lsp/Go.lua
./module/plugin/lsp/Haskell.lua
./module/plugin/lsp/Lua.lua
./module/plugin/lsp/Nix.lua
./module/plugin/lsp/Rust.lua
./module/plugin/lsp/Tex.lua
./module/key/Autocomplete.lua
./module/key/Buffer.lua
./module/key/Cmd.lua
./module/key/Colorscheme.lua
./module/key/Filetree.lua
./module/key/Gitsigns.lua
./module/key/Navigation.lua
./module/key/Prompt.lua
./module/key/Save.lua
./module/key/Sort.lua
./module/key/TabWidth.lua
./module/key/Telescope.lua
./module/key/Terminal.lua
./module/key/Trouble.lua
];
# My configuration files combined into one big file. # Configuration.
cfgRaw = pkgs.writeText "nvim-rc-raw" (util.readFiles configs); accent = config.module.style.color.accent;
cfg = pkgs.replaceVars cfgRaw { bg = config.module.style.color.bg.regular;
inherit fg = config.module.style.color.fg.dark;
accent ollamaModel = config.module.ollama.primaryModel;
bg selection = config.module.style.color.selection;
fg
ollamaModel
selection
;
};
# Tell Neovim to load this file. # Plugin paths to install.
configRc = "lua dofile(\"${cfg}\")"; runtimeRc = builtins.foldl' (acc: r: acc + "set runtimepath+=${r}\n") "" runtimes;
in
runtimeRc + configRc; # 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 in
{ {
text = nvimRc { inherit init;
runtimes = [
"~/.cache/nvim"
"~/.cache/nvim/treesitter"
"${inputs.nvimAlign}"
"${inputs.nvimAutoclose}"
"${inputs.nvimBufferline}"
"${inputs.nvimCloseBuffers}"
"${inputs.nvimColorizer}"
"${inputs.nvimDevicons}"
"${inputs.nvimDressing}"
"${inputs.nvimGen}"
"${inputs.nvimGitsigns}"
"${inputs.nvimGruvboxMaterial}"
"${inputs.nvimIndentoMatic}"
"${inputs.nvimLspconfig}"
"${inputs.nvimPlenary}"
"${inputs.nvimTelescope}"
"${inputs.nvimTodo}"
"${inputs.nvimTreesitter}"
"${inputs.nvimTree}"
"${inputs.nvimTrouble}"
];
configs = [
./module/key/Rekey.lua
./module/key/Leader.lua
./module/config/Autoread.lua
./module/config/Etc.lua
./module/config/Search.lua
./module/config/Tab.lua
./module/config/Highlight.lua
./module/plugin/Filetree.lua
./module/plugin/Gruvbox.lua
./module/plugin/Bufferline.lua
./module/plugin/Autoclose.lua
./module/plugin/Gitsigns.lua
./module/plugin/Trouble.lua
./module/plugin/Closebuffers.lua
./module/plugin/Telescope.lua
./module/plugin/Todo.lua
./module/plugin/Indent.lua
./module/plugin/Align.lua
./module/plugin/Treesitter.lua
./module/plugin/Fold.lua
./module/plugin/Gen.lua
./module/plugin/Colorizer.lua
./module/plugin/Dressing.lua
./module/plugin/lsp/Go.lua
./module/plugin/lsp/Haskell.lua
./module/plugin/lsp/Lua.lua
./module/plugin/lsp/Nix.lua
./module/plugin/lsp/Rust.lua
./module/plugin/lsp/Tex.lua
./module/key/Autocomplete.lua
./module/key/Buffer.lua
./module/key/Cmd.lua
./module/key/Colorscheme.lua
./module/key/Filetree.lua
./module/key/Gitsigns.lua
./module/key/Navigation.lua
./module/key/Prompt.lua
./module/key/Save.lua
./module/key/Sort.lua
./module/key/TabWidth.lua
./module/key/Telescope.lua
./module/key/Terminal.lua
./module/key/Trouble.lua
];
};
} }