mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
telescope-frecency: add options
This commit is contained in:
parent
3d1df5f16a
commit
96685934d7
2 changed files with 57 additions and 2 deletions
|
@ -25,6 +25,12 @@ in
|
||||||
description = "A list of enabled extensions. Don't use this directly";
|
description = "A list of enabled extensions. Don't use this directly";
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extensionConfig = mkOption {
|
||||||
|
type = types.attrsOf types.anything;
|
||||||
|
description = "Configuration for the extensions. Don't use this directly";
|
||||||
|
default = {};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
@ -44,7 +50,9 @@ in
|
||||||
extraConfigLua = ''
|
extraConfigLua = ''
|
||||||
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
||||||
|
|
||||||
require('telescope').setup{}
|
require('telescope').setup{
|
||||||
|
extensions = ${helpers.toLuaObject cfg.extensionConfig}
|
||||||
|
}
|
||||||
|
|
||||||
for i, extension in ipairs(__telescopeExtensions) do
|
for i, extension in ipairs(__telescopeExtensions) do
|
||||||
require('telescope').load_extension(extension)
|
require('telescope').load_extension(extension)
|
||||||
|
|
|
@ -6,9 +6,55 @@ in
|
||||||
{
|
{
|
||||||
options.programs.nixvim.plugins.telescope.extensions.frecency = {
|
options.programs.nixvim.plugins.telescope.extensions.frecency = {
|
||||||
enable = mkEnableOption "Enable 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 = mkIf cfg.enable {
|
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 {
|
||||||
programs.nixvim.extraPackages = [ pkgs.sqlite ];
|
programs.nixvim.extraPackages = [ pkgs.sqlite ];
|
||||||
programs.nixvim.extraPlugins = with pkgs.vimPlugins; [
|
programs.nixvim.extraPlugins = with pkgs.vimPlugins; [
|
||||||
telescope-frecency-nvim
|
telescope-frecency-nvim
|
||||||
|
@ -16,5 +62,6 @@ in
|
||||||
];
|
];
|
||||||
|
|
||||||
programs.nixvim.plugins.telescope.enabledExtensions = [ "frecency" ];
|
programs.nixvim.plugins.telescope.enabledExtensions = [ "frecency" ];
|
||||||
|
programs.nixvim.plugins.telescope.extensionConfig."frecency" = configuration;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue