nichts/modules/programs/editors/nvf/settings.nix

88 lines
2.5 KiB
Nix
Raw Normal View History

2024-09-09 09:14:27 +02:00
# NOTE: Credits go to raf aka Notashelf, who wrote not only nvf
# but also most of this configuration, the
# link to his repo is in the README.md
2024-07-06 15:15:37 +02:00
{
config,
lib,
2024-07-06 17:14:45 +02:00
pkgs,
inputs,
2024-07-06 15:15:37 +02:00
...
}: let
2024-08-13 11:09:42 +02:00
inherit (builtins) filter map toString;
2024-07-06 15:15:37 +02:00
inherit (lib.filesystem) listFilesRecursive;
inherit (lib.strings) hasSuffix fileContents;
inherit (lib.attrsets) genAttrs;
2024-07-22 01:20:41 +02:00
inherit (lib) mkIf;
2024-07-06 15:15:37 +02:00
2024-07-21 17:36:55 +02:00
cfg = config.modules.system.programs.editors.neovim;
2024-07-06 15:15:37 +02:00
nvf = inputs.neovim-flake;
2024-07-28 11:00:54 +02:00
inherit (nvf.lib.nvim.dag) entryBefore;
2024-07-06 15:15:37 +02:00
in {
2024-07-06 17:14:45 +02:00
config = mkIf cfg.enable {
2024-07-06 15:15:37 +02:00
programs.neovim-flake = {
enable = true;
defaultEditor = true;
enableManpages = true;
settings = {
vim = {
# use neovim-unwrapped from nixpkgs
# alternatively, neovim-nightly from the neovim-nightly overlay
# via inputs.neovim-nightly.packages.${pkgs.stdenv.system}.neovim
2024-07-06 17:14:45 +02:00
package = pkgs.neovim-unwrapped;
2024-09-09 09:14:27 +02:00
viAlias = false;
2024-07-06 15:15:37 +02:00
vimAlias = true;
withNodeJs = false;
withPython3 = false;
withRuby = false;
preventJunkFiles = true;
useSystemClipboard = true;
2024-07-10 23:10:52 +02:00
tabWidth = 4;
autoIndent = true;
2024-07-06 15:15:37 +02:00
spellcheck = {
enable = true;
2024-07-07 23:45:18 +02:00
languages = ["en" "de"];
2024-07-06 15:15:37 +02:00
};
enableLuaLoader = true;
enableEditorconfig = true;
2024-07-08 00:13:37 +02:00
debugMode = {
enable = false;
logFile = "/tmp/nvim.log";
};
2024-07-06 15:15:37 +02:00
2024-07-08 00:13:37 +02:00
additionalRuntimePaths = [
2024-07-16 21:31:03 +02:00
./runtime
./runtime
2024-07-08 00:13:37 +02:00
];
2024-07-06 15:15:37 +02:00
# additional lua configuration that I can append
# or, to be more precise, randomly inject into
2024-09-09 09:14:27 +02:00
# the lua configuration of nvf.
# This is recursively read from the lua
2024-07-06 15:15:37 +02:00
# directory, so we do not need to use require
2024-07-10 22:10:54 +02:00
2024-07-08 00:13:37 +02:00
luaConfigRC = let
# get the name of each lua file in the lua directory, where setting files reside
# and import them recursively
configPaths = filter (hasSuffix ".lua") (map toString (listFilesRecursive ./lua));
2024-07-06 15:15:37 +02:00
2024-07-08 00:13:37 +02:00
# generates a key-value pair that looks roughly as follows:
# `<filePath> = entryAnywhere ''<contents of filePath>''`
# which is expected by neovim-flake's modified DAG library
luaConfig = genAttrs configPaths (file:
entryBefore ["luaScript"] ''
${fileContents "${file}"}
'');
in
luaConfig;
2024-07-06 15:15:37 +02:00
};
};
};
};
}