2024-01-02 23:55:32 +00:00
|
|
|
{
|
|
|
|
pkgs,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib.options) mkEnableOption mkOption;
|
2024-04-06 18:07:53 +00:00
|
|
|
inherit (lib.types) int str listOf float bool either enum submodule attrsOf;
|
2024-03-24 00:14:39 +00:00
|
|
|
inherit (lib.nvim.binds) mkMappingOption;
|
2024-04-06 18:07:53 +00:00
|
|
|
inherit (lib.nvim.types) mkPluginSetupOption luaInline;
|
2024-01-02 23:55:32 +00:00
|
|
|
setupOptions = {
|
|
|
|
defaults = {
|
2024-04-06 18:07:53 +00:00
|
|
|
vimgrep_arguments = mkOption {
|
|
|
|
description = ''
|
|
|
|
Defines the command that will be used for `live_grep` and `grep_string` pickers.
|
|
|
|
Make sure that color is set to `never` because telescope does not yet interpret color codes.
|
|
|
|
'';
|
|
|
|
type = listOf str;
|
|
|
|
default = [
|
|
|
|
"${pkgs.ripgrep}/bin/rg"
|
|
|
|
"--color=never"
|
|
|
|
"--no-heading"
|
|
|
|
"--with-filename"
|
|
|
|
"--line-number"
|
|
|
|
"--column"
|
|
|
|
"--smart-case"
|
|
|
|
"--hidden"
|
|
|
|
"--no-ignore"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
pickers.find_command = mkOption {
|
|
|
|
description = "cmd to use for finding files";
|
|
|
|
type = either (listOf str) luaInline;
|
|
|
|
default = ["${pkgs.fd}/bin/fd"];
|
|
|
|
};
|
|
|
|
prompt_prefix = mkOption {
|
|
|
|
description = "Shown in front of Telescope's prompt";
|
|
|
|
type = str;
|
|
|
|
default = " ";
|
|
|
|
};
|
|
|
|
selection_caret = mkOption {
|
|
|
|
description = "Character(s) to show in front of the current selection";
|
|
|
|
type = str;
|
|
|
|
default = " ";
|
|
|
|
};
|
|
|
|
entry_prefix = mkOption {
|
|
|
|
description = "Prefix in front of each result entry. Current selection not included.";
|
|
|
|
type = str;
|
|
|
|
default = " ";
|
|
|
|
};
|
|
|
|
initial_mode = mkOption {
|
|
|
|
description = "Determines in which mode telescope starts.";
|
|
|
|
type = enum ["insert" "normal"];
|
|
|
|
default = "insert";
|
|
|
|
};
|
|
|
|
selection_strategy = mkOption {
|
|
|
|
description = "Determines how the cursor acts after each sort iteration.";
|
|
|
|
type = enum ["reset" "follow" "row" "closest" "none"];
|
|
|
|
default = "reset";
|
|
|
|
};
|
|
|
|
sorting_strategy = mkOption {
|
|
|
|
description = ''Determines the direction "better" results are sorted towards.'';
|
|
|
|
type = enum ["descending" "ascending"];
|
|
|
|
default = "ascending";
|
|
|
|
};
|
|
|
|
layout_strategy = mkOption {
|
|
|
|
description = "Determines the default layout of Telescope pickers. See `:help telescope.layout`.";
|
|
|
|
type = str;
|
|
|
|
default = "horizontal";
|
|
|
|
};
|
|
|
|
layout_config = mkOption {
|
|
|
|
description = ''
|
|
|
|
Determines the default configuration values for layout strategies.
|
|
|
|
See telescope.layout for details of the configurations options for
|
|
|
|
each strategy.
|
|
|
|
'';
|
|
|
|
default = {};
|
|
|
|
type = submodule {
|
|
|
|
options = {
|
|
|
|
horizontal = {
|
|
|
|
prompt_position = mkOption {
|
|
|
|
description = "";
|
|
|
|
type = str;
|
|
|
|
default = "top";
|
|
|
|
};
|
|
|
|
preview_width = mkOption {
|
|
|
|
description = "";
|
|
|
|
type = float;
|
|
|
|
default = 0.55;
|
|
|
|
};
|
|
|
|
results_width = mkOption {
|
|
|
|
description = "";
|
|
|
|
type = float;
|
|
|
|
default = 0.8;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
vertical = {
|
|
|
|
mirror = mkOption {
|
|
|
|
description = "";
|
|
|
|
type = bool;
|
|
|
|
default = false;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
width = mkOption {
|
|
|
|
description = "";
|
|
|
|
type = float;
|
|
|
|
default = 0.8;
|
|
|
|
};
|
|
|
|
height = mkOption {
|
|
|
|
description = "";
|
|
|
|
type = float;
|
|
|
|
default = 0.8;
|
|
|
|
};
|
|
|
|
preview_cutoff = mkOption {
|
|
|
|
description = "";
|
|
|
|
type = int;
|
|
|
|
default = 120;
|
|
|
|
};
|
|
|
|
};
|
2024-01-02 23:55:32 +00:00
|
|
|
};
|
2024-04-06 18:07:53 +00:00
|
|
|
};
|
|
|
|
file_ignore_patterns = mkOption {
|
|
|
|
description = "A table of lua regex that define the files that should be ignored.";
|
|
|
|
type = listOf str;
|
|
|
|
default = ["node_modules" ".git/" "dist/" "build/" "target/" "result/"];
|
|
|
|
};
|
|
|
|
color_devicons = mkOption {
|
|
|
|
description = "Boolean if devicons should be enabled or not.";
|
|
|
|
type = bool;
|
|
|
|
default = true;
|
|
|
|
};
|
|
|
|
path_display = mkOption {
|
|
|
|
description = "Determines how file paths are displayed.";
|
|
|
|
type = listOf (enum ["hidden" "tail" "absolute" "smart" "shorten" "truncate"]);
|
|
|
|
default = ["absolute"];
|
|
|
|
};
|
|
|
|
set_env = mkOption {
|
2024-11-26 07:36:39 +00:00
|
|
|
description = "Set an environment for term_previewer";
|
2024-04-06 18:07:53 +00:00
|
|
|
type = attrsOf str;
|
|
|
|
default = {
|
|
|
|
COLORTERM = "truecolor";
|
2024-01-02 23:55:32 +00:00
|
|
|
};
|
|
|
|
};
|
2024-04-06 18:07:53 +00:00
|
|
|
winblend = mkOption {
|
|
|
|
description = "pseudo-transparency of keymap hints floating window";
|
|
|
|
type = int;
|
|
|
|
default = 0;
|
2024-01-02 23:55:32 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2023-11-07 00:50:27 +00:00
|
|
|
in {
|
2023-02-28 07:13:56 +00:00
|
|
|
options.vim.telescope = {
|
2023-04-22 13:48:21 +00:00
|
|
|
mappings = {
|
2024-09-08 15:44:42 +00:00
|
|
|
findProjects = mkMappingOption "Find projects [Telescope]" "<leader>fp";
|
2023-04-22 13:48:21 +00:00
|
|
|
findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff";
|
2023-05-02 22:26:21 +00:00
|
|
|
liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg";
|
|
|
|
buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb";
|
|
|
|
helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh";
|
|
|
|
open = mkMappingOption "Open [Telescope]" "<leader>ft";
|
2024-09-08 15:44:42 +00:00
|
|
|
resume = mkMappingOption "Resume (previous search) [Telescope]" "<leader>fr";
|
2023-04-22 13:48:21 +00:00
|
|
|
|
2023-05-02 22:26:21 +00:00
|
|
|
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
|
|
|
|
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";
|
|
|
|
gitBranches = mkMappingOption "Git branches [Telescope]" "<leader>fvb";
|
|
|
|
gitStatus = mkMappingOption "Git status [Telescope]" "<leader>fvs";
|
|
|
|
gitStash = mkMappingOption "Git stash [Telescope]" "<leader>fvx";
|
2023-04-22 13:48:21 +00:00
|
|
|
|
2023-05-02 22:26:21 +00:00
|
|
|
lspDocumentSymbols = mkMappingOption "LSP Document Symbols [Telescope]" "<leader>flsb";
|
|
|
|
lspWorkspaceSymbols = mkMappingOption "LSP Workspace Symbols [Telescope]" "<leader>flsw";
|
|
|
|
lspReferences = mkMappingOption "LSP References [Telescope]" "<leader>flr";
|
|
|
|
lspImplementations = mkMappingOption "LSP Implementations [Telescope]" "<leader>fli";
|
|
|
|
lspDefinitions = mkMappingOption "LSP Definitions [Telescope]" "<leader>flD";
|
|
|
|
lspTypeDefinitions = mkMappingOption "LSP Type Definitions [Telescope]" "<leader>flt";
|
|
|
|
diagnostics = mkMappingOption "Diagnostics [Telescope]" "<leader>fld";
|
2023-04-22 13:48:21 +00:00
|
|
|
|
2023-05-02 22:26:21 +00:00
|
|
|
treesitter = mkMappingOption "Treesitter [Telescope]" "<leader>fs";
|
2023-04-22 13:48:21 +00:00
|
|
|
};
|
|
|
|
|
2023-06-05 23:22:55 +00:00
|
|
|
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
2024-01-02 23:55:32 +00:00
|
|
|
|
|
|
|
setupOpts = mkPluginSetupOption "Telescope" setupOptions;
|
2023-02-28 07:13:56 +00:00
|
|
|
};
|
|
|
|
}
|