nix-community.nixvim/plugins/telescope/default.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

66 lines
1.6 KiB
Nix

{ pkgs, config, lib, ... }:
with lib;
let
cfg = config.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.plugins.telescope = {
enable = mkEnableOption "Enable telescope.nvim";
highlightTheme = mkOption {
type = types.nullOr types.str;
description = "The colorscheme to use for syntax highlighting";
default = config.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 {
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
'';
};
}