2021-12-23 20:01:49 +01:00
|
|
|
{ pkgs, config, lib, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.nixvim.plugins.telescope;
|
|
|
|
helpers = (import ../helpers.nix { inherit lib; });
|
|
|
|
in
|
|
|
|
{
|
2021-12-23 20:12:37 +01:00
|
|
|
imports = [
|
|
|
|
./frecency.nix
|
2021-12-23 21:51:56 +01:00
|
|
|
./fzf-native.nix
|
2021-12-23 20:12:37 +01:00
|
|
|
];
|
|
|
|
|
2021-12-23 20:01:49 +01:00
|
|
|
# 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 = [];
|
|
|
|
};
|
2021-12-23 21:29:17 +01:00
|
|
|
|
|
|
|
extensionConfig = mkOption {
|
|
|
|
type = types.attrsOf types.anything;
|
|
|
|
description = "Configuration for the extensions. Don't use this directly";
|
|
|
|
default = {};
|
|
|
|
};
|
2021-12-23 20:01:49 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
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 = ''
|
|
|
|
local __telescopeExtensions = ${helpers.toLuaObject cfg.enabledExtensions}
|
|
|
|
|
2021-12-23 21:29:17 +01:00
|
|
|
require('telescope').setup{
|
|
|
|
extensions = ${helpers.toLuaObject cfg.extensionConfig}
|
|
|
|
}
|
2021-12-23 20:01:49 +01:00
|
|
|
|
|
|
|
for i, extension in ipairs(__telescopeExtensions) do
|
|
|
|
require('telescope').load_extension(extension)
|
|
|
|
end
|
|
|
|
'' ;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|