home: vim: refactor linked directories

This is more DRY.
This commit is contained in:
Bruno BELANYI 2021-02-23 15:31:23 +00:00
parent f1e4a4d914
commit fdc150bea2
2 changed files with 15 additions and 23 deletions

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ pkgs, lib, ... }:
{
programs.neovim = {
enable = true;
@ -46,21 +46,18 @@
extraConfig = builtins.readFile ./init.vim;
};
xdg.configFile = {
"nvim/after" = {
source = ./after;
};
"nvim/autoload" = {
source = ./autoload;
};
"nvim/ftdetect" = {
source = ./ftdetect;
};
"nvim/plugin" = {
source = ./plugin;
};
};
xdg.configFile =
let
toSource = directory: { source = ./. + "/${directory}"; };
configureDirectory =
name: lib.nameValuePair "nvim/${name}" (toSource name);
linkDirectories =
dirs: builtins.listToAttrs (map configureDirectory dirs);
in
linkDirectories [
"after"
"autoload"
"ftdetect"
"plugin"
];
}

View file

@ -1,5 +0,0 @@
" Enable trailing whitespace high-lighting
let g:better_whitespace_enabled=1
" Strip trailing whitespace on file-save
let g:strip_whitespace_on_save=1