nix-community.nixvim/plugins/telescope/frecency.nix
Pedro Alves 4ddd3969e5
nixvim: support standalone nixvim
This represents a major rearchitecture for nixvim, so I'm leaving this up to track the progress for now, and to serve as a reference for any breaking changes during transition.

The main change is, of course, being able to use nixvim standalone. To do this, you should use the new build function, which takes in two arguments: the system architecture (e.g. x86_64-linux) and the configuration. For the new configuration, do not use the programs.nixvim. prefix.

For module development, the main change is that you should no longer prefix your modules with programs.nixvim..
2022-09-18 11:19:23 +01:00

67 lines
2.1 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.plugins.telescope.extensions.frecency;
in
{
options.plugins.telescope.extensions.frecency = {
enable = mkEnableOption "Enable frecency";
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;
};
};
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 {
extraPackages = [ pkgs.sqlite ];
extraPlugins = with pkgs.vimPlugins; [
telescope-frecency-nvim
sqlite-lua
];
plugins.telescope.enabledExtensions = [ "frecency" ];
plugins.telescope.extensionConfig."frecency" = configuration;
};
}