mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 04:58:01 +00:00
nixvim/plugins/nvim-config-local: init
This commit is contained in:
parent
e5ace891b0
commit
cc488eb391
@ -2,5 +2,6 @@
|
||||
imports = [
|
||||
./keyunmaps.nix
|
||||
./plugins/firenvim.nix
|
||||
./plugins/nvim-config-local.nix
|
||||
];
|
||||
}
|
||||
|
43
modules/nixvim/plugins/nvim-config-local.nix
Normal file
43
modules/nixvim/plugins/nvim-config-local.nix
Normal file
@ -0,0 +1,43 @@
|
||||
{ config, lib, pkgs, helpers, ... }:
|
||||
|
||||
let
|
||||
cfg = config.plugins.nvim-config-local;
|
||||
in
|
||||
{
|
||||
options.plugins.nvim-config-local =
|
||||
helpers.neovim-plugin.extraOptionsOptions // {
|
||||
enable = lib.mkEnableOption "nvim-config-local";
|
||||
|
||||
package = helpers.mkPackageOption "nvim-config-local" pkgs.vimPlugins.nvim-config-local;
|
||||
|
||||
configFiles = lib.mkOption {
|
||||
type = with lib.types; listOf str;
|
||||
default = [ ".nvim.lua" ".nvimrc" ".exrc" ];
|
||||
example = [ "config/nvim.lua" ];
|
||||
description = ''
|
||||
A list of patterns to load (includes Lua configurations).
|
||||
'';
|
||||
};
|
||||
|
||||
autocommandsCreate = helpers.defaultNullOpts.mkBool true "Create autocommands for sourcing local files.";
|
||||
commandsCreate = helpers.defaultNullOpts.mkBool true "Create user commands for nvim-config-local.";
|
||||
lookupParents = helpers.defaultNullOpts.mkBool false "Enable lookup in parent directories when sourcing local configs.";
|
||||
};
|
||||
|
||||
config =
|
||||
let
|
||||
setupOptions = {
|
||||
config_files = cfg.configFiles;
|
||||
autocommands_create = cfg.autocommandsCreate;
|
||||
commands_create = cfg.commandsCreate;
|
||||
lookup_parents = cfg.lookupParents;
|
||||
} // cfg.extraOptions;
|
||||
in
|
||||
lib.mkIf cfg.enable {
|
||||
extraPlugins = [ cfg.package ];
|
||||
|
||||
extraConfigLua = ''
|
||||
require("config-local").setup(${helpers.toLuaConfig setupOptions})
|
||||
'';
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user