mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-26 15:06:45 +00:00
feat(telescope): add custom setup options
This commit is contained in:
parent
376c8bafd0
commit
df8784c65f
2 changed files with 62 additions and 49 deletions
|
@ -11,7 +11,7 @@
|
|||
inherit (lib) pushDownDefault;
|
||||
|
||||
cfg = config.vim.telescope;
|
||||
self = import ./telescope.nix {inherit lib;};
|
||||
self = import ./telescope.nix {inherit pkgs lib;};
|
||||
mappingDefinitions = self.options.vim.telescope.mappings;
|
||||
|
||||
mappings = addDescriptionsToMappings cfg.mappings mappingDefinitions;
|
||||
|
@ -66,52 +66,7 @@ in {
|
|||
|
||||
vim.luaConfigRC.telescope = entryAnywhere ''
|
||||
local telescope = require('telescope')
|
||||
telescope.setup {
|
||||
defaults = {
|
||||
vimgrep_arguments = {
|
||||
"${pkgs.ripgrep}/bin/rg",
|
||||
"--color=never",
|
||||
"--no-heading",
|
||||
"--with-filename",
|
||||
"--line-number",
|
||||
"--column",
|
||||
"--smart-case",
|
||||
"--hidden",
|
||||
"--no-ignore",
|
||||
},
|
||||
pickers = {
|
||||
find_command = {
|
||||
"${pkgs.fd}/bin/fd",
|
||||
},
|
||||
},
|
||||
},
|
||||
prompt_prefix = " ",
|
||||
selection_caret = " ",
|
||||
entry_prefix = " ",
|
||||
initial_mode = "insert",
|
||||
selection_strategy = "reset",
|
||||
sorting_strategy = "ascending",
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = "top",
|
||||
preview_width = 0.55,
|
||||
results_width = 0.8,
|
||||
},
|
||||
vertical = {
|
||||
mirror = false,
|
||||
},
|
||||
width = 0.8,
|
||||
height = 0.8,
|
||||
preview_cutoff = 120,
|
||||
},
|
||||
file_ignore_patterns = { "node_modules", ".git/", "dist/", "build/", "target/", "result/" }, -- TODO: make this configurable
|
||||
color_devicons = true,
|
||||
path_display = { "absolute" },
|
||||
set_env = { ["COLORTERM"] = "truecolor" },
|
||||
winblend = 0,
|
||||
border = {},
|
||||
}
|
||||
telescope.setup(${nvim.lua.toLuaObject cfg.setupOpts})
|
||||
|
||||
${
|
||||
if config.vim.ui.noice.enable
|
||||
|
|
|
@ -1,6 +1,62 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption;
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) int str listOf float bool;
|
||||
inherit (lib.nvim.binds) mkMappingOption;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
mkOptOfType = type: default:
|
||||
mkOption {
|
||||
# TODO: description
|
||||
description = "See plugin docs for more info";
|
||||
inherit type default;
|
||||
};
|
||||
|
||||
setupOptions = {
|
||||
defaults = {
|
||||
vimgrep_arguments = mkOptOfType (listOf str) [
|
||||
"${pkgs.ripgrep}/bin/rg"
|
||||
"--color=never"
|
||||
"--no-heading"
|
||||
"--with-filename"
|
||||
"--line-number"
|
||||
"--column"
|
||||
"--smart-case"
|
||||
"--hidden"
|
||||
"--no-ignore"
|
||||
];
|
||||
pickers.find_command = mkOptOfType (listOf str) ["${pkgs.fd}/bin/fd"];
|
||||
prompt_prefix = mkOptOfType str " ";
|
||||
selection_caret = mkOptOfType str " ";
|
||||
entry_prefix = mkOptOfType str " ";
|
||||
initial_mode = mkOptOfType str "insert";
|
||||
selection_strategy = mkOptOfType str "reset";
|
||||
sorting_strategy = mkOptOfType str "ascending";
|
||||
layout_strategy = mkOptOfType str "horizontal";
|
||||
layout_config = {
|
||||
horizontal = {
|
||||
prompt_position = mkOptOfType str "top";
|
||||
preview_width = mkOptOfType float 0.55;
|
||||
results_width = mkOptOfType float 0.8;
|
||||
};
|
||||
vertical = {
|
||||
mirror = mkOptOfType bool false;
|
||||
};
|
||||
width = mkOptOfType float 0.8;
|
||||
height = mkOptOfType float 0.8;
|
||||
preview_cutoff = mkOptOfType int 120;
|
||||
};
|
||||
file_ignore_patterns = mkOptOfType (listOf str) ["node_modules" ".git/" "dist/" "build/" "target/" "result/"];
|
||||
color_devicons = mkOptOfType bool true;
|
||||
path_display = mkOptOfType (listOf str) ["absolute"];
|
||||
set_env = {
|
||||
COLORTERM = mkOptOfType str "truecolor";
|
||||
};
|
||||
winblend = mkOptOfType int 0;
|
||||
};
|
||||
};
|
||||
in {
|
||||
options.vim.telescope = {
|
||||
mappings = {
|
||||
|
@ -30,5 +86,7 @@ in {
|
|||
};
|
||||
|
||||
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
|
||||
|
||||
setupOpts = mkPluginSetupOption "Telescope" setupOptions;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue