2024-07-08 21:57:58 +00:00
|
|
|
{lib, ...}: let
|
2024-04-19 19:28:07 +00:00
|
|
|
inherit (lib.options) mkEnableOption mkOption;
|
|
|
|
inherit (lib.modules) mkRenamedOptionModule;
|
|
|
|
inherit (lib.types) bool listOf str enum;
|
|
|
|
inherit (lib.nvim.types) mkPluginSetupOption;
|
2023-11-07 00:50:27 +00:00
|
|
|
in {
|
2024-02-17 22:29:58 +00: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"])
|
|
|
|
];
|
|
|
|
|
2023-06-05 20:10:25 +00:00
|
|
|
options.vim.projects.project-nvim = {
|
2023-10-21 17:15:36 +00:00
|
|
|
enable = mkEnableOption "project-nvim for project management";
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-04-19 19:28:07 +00:00
|
|
|
setupOpts = mkPluginSetupOption "Project.nvim" {
|
2024-02-17 22:29:58 +00:00
|
|
|
manual_mode = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = bool;
|
2024-02-17 22:29:58 +00:00
|
|
|
default = true;
|
|
|
|
description = "don't automatically change the root directory so the user has the option to manually do so using `:ProjectRoot` command";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-02-17 22:29:58 +00:00
|
|
|
# detection methods should accept one or more strings from a list
|
|
|
|
detection_methods = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = listOf str;
|
2024-02-17 22:29:58 +00:00
|
|
|
default = ["lsp" "pattern"];
|
|
|
|
description = "Detection methods to use";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-02-17 22:29:58 +00:00
|
|
|
# patterns
|
|
|
|
patterns = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = listOf str;
|
2024-02-17 22:29:58 +00:00
|
|
|
default = [".git" "_darcs" ".hg" ".bzr" ".svn" "Makefile" "package.json" "flake.nix" "cargo.toml"];
|
|
|
|
description = "Patterns to use for pattern detection method";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-02-17 22:29:58 +00:00
|
|
|
# table of lsp servers to ignore by name
|
|
|
|
lsp_ignored = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = listOf str;
|
2024-02-17 22:29:58 +00:00
|
|
|
default = [];
|
|
|
|
description = "LSP servers no ignore by name";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-02-17 22:29:58 +00:00
|
|
|
exclude_dirs = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = listOf str;
|
2024-02-17 22:29:58 +00:00
|
|
|
default = [];
|
|
|
|
description = "Directories to exclude from project root search";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-02-17 22:29:58 +00:00
|
|
|
show_hidden = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = bool;
|
2024-02-17 22:29:58 +00:00
|
|
|
default = false;
|
|
|
|
description = "Show hidden files in telescope picker";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-02-17 22:29:58 +00:00
|
|
|
silent_chdir = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = bool;
|
2024-02-17 22:29:58 +00:00
|
|
|
default = true;
|
|
|
|
description = "Silently change directory when changing project";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
|
2024-02-17 22:29:58 +00:00
|
|
|
scope_chdir = mkOption {
|
2024-04-19 19:28:07 +00:00
|
|
|
type = enum ["global" "tab" "win"];
|
2024-02-17 22:29:58 +00:00
|
|
|
default = "global";
|
|
|
|
description = "What scope to change the directory";
|
|
|
|
};
|
2023-06-05 20:10:25 +00:00
|
|
|
};
|
2023-04-07 17:35:04 +00:00
|
|
|
};
|
|
|
|
}
|