2021-12-23 20:12:37 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
with lib;
|
2023-01-21 18:12:09 +01:00
|
|
|
let
|
2022-09-18 11:19:23 +01:00
|
|
|
cfg = config.plugins.telescope.extensions.frecency;
|
2021-12-23 20:12:37 +01:00
|
|
|
in
|
|
|
|
{
|
2022-09-18 11:19:23 +01:00
|
|
|
options.plugins.telescope.extensions.frecency = {
|
2021-12-23 20:12:37 +01:00
|
|
|
enable = mkEnableOption "Enable frecency";
|
2021-12-23 21:29:17 +01:00
|
|
|
|
2023-01-19 10:45:15 +00:00
|
|
|
package = mkOption {
|
|
|
|
type = types.package;
|
|
|
|
default = pkgs.vimPlugins.telescope-frecency-nvim;
|
|
|
|
description = "Plugin to use for telescope frecency";
|
|
|
|
};
|
|
|
|
|
2021-12-23 21:29:17 +01:00
|
|
|
dbRoot = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "Path to parent directory of custom database location. Defaults to $XDG_DATA_HOME/nvim";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
defaultWorkspace = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
description = "Default workspace tag to filter by e.g 'CWD' to filter by default to the current directory";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
ignorePatterns = mkOption {
|
|
|
|
type = types.nullOr (types.listOf types.str);
|
|
|
|
description = "Patterns in this list control which files are indexed";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
showScores = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
description = "Whether to show scores generated by the algorithm in the results";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
workspaces = mkOption {
|
|
|
|
type = types.nullOr (types.attrsOf types.str);
|
|
|
|
description = "this table contains mappings of workspace_tag -> workspace_directory";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
showUnindexed = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
description = "Determines if non-indexed files are included in workspace filter results";
|
|
|
|
default = null;
|
|
|
|
};
|
|
|
|
deviconsDisabled = mkOption {
|
|
|
|
type = types.nullOr types.bool;
|
|
|
|
description = "Disable devicons (if available)";
|
|
|
|
default = null;
|
|
|
|
};
|
2021-12-23 20:12:37 +01:00
|
|
|
};
|
|
|
|
|
2021-12-23 21:29:17 +01:00
|
|
|
config = let
|
|
|
|
configuration = {
|
|
|
|
db_root = cfg.dbRoot;
|
|
|
|
default_workspace = cfg.defaultWorkspace;
|
|
|
|
ignore_patterns = cfg.ignorePatterns;
|
|
|
|
show_scores = cfg.showScores;
|
|
|
|
workspaces = cfg.workspaces;
|
|
|
|
show_unindexed = cfg.showUnindexed;
|
|
|
|
devicons_disabled = cfg.deviconsDisabled;
|
|
|
|
};
|
|
|
|
in mkIf cfg.enable {
|
2022-09-18 11:19:23 +01:00
|
|
|
extraPackages = [ pkgs.sqlite ];
|
|
|
|
extraPlugins = with pkgs.vimPlugins; [
|
2023-01-19 10:45:15 +00:00
|
|
|
cfg.package
|
2021-12-23 20:12:37 +01:00
|
|
|
sqlite-lua
|
|
|
|
];
|
|
|
|
|
2022-09-18 11:19:23 +01:00
|
|
|
plugins.telescope.enabledExtensions = [ "frecency" ];
|
|
|
|
plugins.telescope.extensionConfig."frecency" = configuration;
|
2021-12-23 20:12:37 +01:00
|
|
|
};
|
|
|
|
}
|