mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
telescope-frecency: init plugin
This commit is contained in:
parent
6f8eb6f381
commit
3d1df5f16a
3 changed files with 24 additions and 56 deletions
|
@ -5,6 +5,10 @@ let
|
||||||
helpers = (import ../helpers.nix { inherit lib; });
|
helpers = (import ../helpers.nix { inherit lib; });
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
imports = [
|
||||||
|
./frecency.nix
|
||||||
|
];
|
||||||
|
|
||||||
# TODO:add support for aditional filetypes. This requires autocommands!
|
# TODO:add support for aditional filetypes. This requires autocommands!
|
||||||
|
|
||||||
options.programs.nixvim.plugins.telescope = {
|
options.programs.nixvim.plugins.telescope = {
|
||||||
|
|
20
plugins/telescope/frecency.nix
Normal file
20
plugins/telescope/frecency.nix
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
{ pkgs, config, lib, ... }:
|
||||||
|
with lib;
|
||||||
|
let
|
||||||
|
cfg = config.programs.nixvim.plugins.telescope.extensions.frecency;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
options.programs.nixvim.plugins.telescope.extensions.frecency = {
|
||||||
|
enable = mkEnableOption "Enable frecency";
|
||||||
|
};
|
||||||
|
|
||||||
|
config = mkIf cfg.enable {
|
||||||
|
programs.nixvim.extraPackages = [ pkgs.sqlite ];
|
||||||
|
programs.nixvim.extraPlugins = with pkgs.vimPlugins; [
|
||||||
|
telescope-frecency-nvim
|
||||||
|
sqlite-lua
|
||||||
|
];
|
||||||
|
|
||||||
|
programs.nixvim.plugins.telescope.enabledExtensions = [ "frecency" ];
|
||||||
|
};
|
||||||
|
}
|
|
@ -1,56 +0,0 @@
|
||||||
{ pkgs, config, lib, ... }:
|
|
||||||
with lib;
|
|
||||||
let
|
|
||||||
cfg = config.programs.nixvim.plugins.telescope;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
# TODO Add support for aditional filetypes. This requires autocommands!
|
|
||||||
|
|
||||||
options.programs.nixvim.plugins.telescope = {
|
|
||||||
enable = mkEnableOption "Enable telescope.nvim";
|
|
||||||
|
|
||||||
highlightTheme = mkOption {
|
|
||||||
default = config.programs.nixvim.colorscheme;
|
|
||||||
type = types.nullOr types.str;
|
|
||||||
description = "The colorscheme to use for syntax highlighting";
|
|
||||||
};
|
|
||||||
|
|
||||||
extensions = {
|
|
||||||
frecency = {
|
|
||||||
enable = mkEnableOption "Enable telescope-frecency";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
config = let
|
|
||||||
extensionPlugins = with cfg.extensions; with pkgs.vimPlugins;
|
|
||||||
(optional frecency.enable telescope-frecency-nvim) ++
|
|
||||||
(optional frecency.enable sqlite-lua);
|
|
||||||
|
|
||||||
extensionPackages = with cfg.extensions; with pkgs;
|
|
||||||
(optional frecency.enable sqlite);
|
|
||||||
|
|
||||||
extensions = with cfg.extensions;
|
|
||||||
(optional frecency.enable "frecency");
|
|
||||||
|
|
||||||
loadExtensions = "require('telescope')" + (concatMapStrings (e: ".load_extension('${e}')") extensions);
|
|
||||||
in mkIf cfg.enable {
|
|
||||||
programs.nixvim = {
|
|
||||||
extraPackages = with pkgs; [
|
|
||||||
bat
|
|
||||||
] ++ extensionPackages;
|
|
||||||
|
|
||||||
extraPlugins = with pkgs.vimPlugins; [
|
|
||||||
telescope-nvim
|
|
||||||
plenary-nvim
|
|
||||||
popup-nvim
|
|
||||||
] ++ extensionPlugins;
|
|
||||||
|
|
||||||
extraConfigVim = mkIf (cfg.highlightTheme != null) ''
|
|
||||||
let $BAT_THEME = '${cfg.highlightTheme}'
|
|
||||||
'';
|
|
||||||
|
|
||||||
extraConfigLua = mkIf (extensions != []) loadExtensions;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue