feat(plugins/telescope): allow to run extension with theme
This commit is contained in:
parent
488bf61523
commit
9183c5dca3
1 changed files with 11 additions and 4 deletions
|
|
@ -36,7 +36,7 @@
|
||||||
# │ └────────────────────────────────────────┘ │
|
# │ └────────────────────────────────────────┘ │
|
||||||
# └──────────────────────────────────────────────────┘
|
# └──────────────────────────────────────────────────┘
|
||||||
extraConfigLuaPre = ''
|
extraConfigLuaPre = ''
|
||||||
local TelescopeWithTheme = function(fn, args)
|
local TelescopeWithTheme = function(fn, args, extension)
|
||||||
args.layout_config = {
|
args.layout_config = {
|
||||||
anchor = "N",
|
anchor = "N",
|
||||||
mirror = true,
|
mirror = true,
|
||||||
|
|
@ -45,7 +45,13 @@
|
||||||
|
|
||||||
if fn == "keymaps" or fn == "registers" then args.layout_config.height = function(_, _, max_lines) return max_lines end end
|
if fn == "keymaps" or fn == "registers" then args.layout_config.height = function(_, _, max_lines) return max_lines end end
|
||||||
|
|
||||||
require("telescope.builtin")[fn](require("telescope.themes").get_dropdown(args))
|
local args_with_theme = require("telescope.themes").get_dropdown(args)
|
||||||
|
|
||||||
|
if extension ~= "" then
|
||||||
|
require("telescope").extensions[extension][fn](args_with_theme)
|
||||||
|
else
|
||||||
|
require("telescope.builtin")[fn](args_with_theme)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
@ -54,14 +60,15 @@
|
||||||
let
|
let
|
||||||
mkTelescopeKeymap =
|
mkTelescopeKeymap =
|
||||||
{ key
|
{ key
|
||||||
, mode ? "n"
|
|
||||||
, fn
|
, fn
|
||||||
, args ? { __empty = true; }
|
, args ? { __empty = true; }
|
||||||
, desc ? ""
|
, desc ? ""
|
||||||
|
, extension ? null
|
||||||
|
, mode ? "n"
|
||||||
}: {
|
}: {
|
||||||
inherit key mode;
|
inherit key mode;
|
||||||
|
|
||||||
action.__raw = "function() TelescopeWithTheme('${fn}', ${helpers.toLuaObject args}) end";
|
action.__raw = "function() TelescopeWithTheme('${fn}', ${helpers.toLuaObject args}, '${builtins.toString extension}') end";
|
||||||
options = { inherit desc; };
|
options = { inherit desc; };
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue