neovim-flake/modules/plugins/projects/project-nvim/project-nvim.nix

81 lines
2.5 KiB
Nix
Raw Normal View History

2024-02-17 23:29:58 +01:00
{
config,
lib,
...
}: let
inherit (lib) mkEnableOption mkOption types mkRenamedOptionModule;
in {
2024-02-17 23:29:58 +01:00
imports = let
renamedSetupOption = oldPath: newPath:
mkRenamedOptionModule
(["vim" "projects" "project-nvim"] ++ oldPath)
(["vim" "projects" "project-nvim" "setupOpts"] ++ newPath);
in [
(renamedSetupOption ["manualMode"] ["manual_mode"])
(renamedSetupOption ["detectionMethods"] ["detection_methods"])
(renamedSetupOption ["patterns"] ["patterns"])
(renamedSetupOption ["lspIgnored"] ["lsp_ignored"])
(renamedSetupOption ["excludeDirs"] ["exclude_dirs"])
(renamedSetupOption ["showHidden"] ["show_hidden"])
(renamedSetupOption ["silentChdir"] ["silent_chdir"])
(renamedSetupOption ["scopeChdir"] ["scope_chdir"])
];
options.vim.projects.project-nvim = {
enable = mkEnableOption "project-nvim for project management";
2024-02-17 23:29:58 +01:00
setupOpts = lib.nvim.types.mkPluginSetupOption "Project.nvim" {
manual_mode = mkOption {
type = types.bool;
default = true;
description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command";
};
2024-02-17 23:29:58 +01:00
# detection methods should accept one or more strings from a list
detection_methods = mkOption {
type = types.listOf types.str;
default = ["lsp" "pattern"];
description = "Detection methods to use";
};
2024-02-17 23:29:58 +01:00
# patterns
patterns = mkOption {
type = types.listOf types.str;
default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"];
description = "Patterns to use for pattern detection method";
};
2024-02-17 23:29:58 +01:00
# table of lsp servers to ignore by name
lsp_ignored = mkOption {
type = types.listOf types.str;
default = [];
description = "LSP servers no ignore by name";
};
2024-02-17 23:29:58 +01:00
exclude_dirs = mkOption {
type = types.listOf types.str;
default = [];
description = "Directories to exclude from project root search";
};
2024-02-17 23:29:58 +01:00
show_hidden = mkOption {
type = types.bool;
default = false;
description = "Show hidden files in telescope picker";
};
2024-02-17 23:29:58 +01:00
silent_chdir = mkOption {
type = types.bool;
default = true;
description = "Silently change directory when changing project";
};
2024-02-17 23:29:58 +01:00
scope_chdir = mkOption {
type = types.enum ["global" "tab" "win"];
default = "global";
description = "What scope to change the directory";
};
};
2023-04-07 19:35:04 +02:00
};
}