nix-community.nixvim/plugins/telescope/default.nix
Alexander Nortung 3bce3ed48f
telescope.media_files: init (#29)
* telescope.media_files: init

* telescope-media: fix typo

`nollOr` -> `nullOr`

Co-authored-by: Pedro Alves <pta2002@users.noreply.github.com>
2022-08-28 00:26:03 +01:00

68 lines
1.7 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.programs.nixvim.plugins.telescope;
helpers = (import ../helpers.nix { inherit lib; });
in
{
imports = [
./frecency.nix
./fzf-native.nix
./fzy-native.nix
./media-files.nix
];
# TODO:add support for aditional filetypes. This requires autocommands!
options.programs.nixvim.plugins.telescope = {
enable = mkEnableOption "Enable telescope.nvim";
highlightTheme = mkOption {
type = types.nullOr types.str;
description = "The colorscheme to use for syntax highlighting";
default = config.programs.nixvim.colorscheme;
};
enabledExtensions = mkOption {
type = types.listOf types.str;
description = "A list of enabled extensions. Don't use this directly";
default = [ ];
};
extensionConfig = mkOption {
type = types.attrsOf types.anything;
description = "Configuration for the extensions. Don't use this directly";
default = { };
};
};
config = mkIf cfg.enable {
programs.nixvim = {
extraPackages = [ pkgs.bat ];
extraPlugins = with pkgs.vimPlugins; [
telescope-nvim
plenary-nvim
popup-nvim
];
extraConfigVim = mkIf (cfg.highlightTheme != null) ''
let $BAT_THEME = '${cfg.highlightTheme}'
'';
extraConfigLua = ''
do
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
require('telescope').setup{
extensions = ${helpers.toLuaObject cfg.extensionConfig}
}
for i, extension in ipairs(__telescopeExtensions) do
require('telescope').load_extension(extension)
end
end
'';
};
};
}