Skip to content

Commit

Permalink
telescope-nvim: init
Browse files Browse the repository at this point in the history
  • Loading branch information
pta2002 committed Mar 17, 2021
1 parent 5474eba commit 080c8af
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 0 deletions.
12 changes: 12 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
enable = true;
};

extraPlugins = [
pkgs.vimPlugins.vim-nix
];

options.number = true;
options.mouse = "a";

maps.normalVisualOp."ç" = ":";

Expand All @@ -65,6 +70,13 @@
servers.clangd.enable = true;
};

plugins.telescope = {
enable = true;
extensions = {
frecency.enable = true;
};
};

globals = {
vimsyn_embed = "l";
mapleader = " ";
Expand Down
1 change: 1 addition & 0 deletions plugins/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
./utils/startify.nix
./utils/goyo.nix
./utils/endwise.nix
./utils/telescope.nix

./languages/treesitter.nix
./languages/nix.nix
Expand Down
56 changes: 56 additions & 0 deletions plugins/utils/telescope.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{ 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 sql-nvim);

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;
};
};
}

0 comments on commit 080c8af

Please sign in to comment.