Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(builtin.colorscheme): add option ignore_builtins #3155

Merged
merged 3 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions doc/telescope.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1478,10 +1478,12 @@ builtin.colorscheme({opts}) *telescope.builtin.colorscheme()*
{opts} (table) options to pass to the picker

Options: ~
{colors} (table) a list of additional colorschemes to
explicitly make available to telescope
(default: {})
{enable_preview} (boolean) if true, will preview the selected color
{colors} (table) a list of additional colorschemes to
explicitly make available to telescope
(default: {})
{enable_preview} (boolean) if true, will preview the selected color
{ignore_builtins} (boolean) if true, builtin colorschemes are not
listed


builtin.marks({opts}) *telescope.builtin.marks()*
Expand Down
13 changes: 13 additions & 0 deletions lua/telescope/builtin/__internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,19 @@ internal.colorscheme = function(opts)
end, vim.fn.getcompletion("", "color"))
)

if opts.ignore_builtins then
-- stylua: ignore
local builtins = {
"zellner", "torte", "slate", "shine", "ron", "quiet", "peachpuff",
"pablo", "murphy", "lunaperche", "koehler", "industry", "evening",
"elflord", "desert", "delek", "darkblue", "blue", "morning", "vim",
"habamax", "retrobox", "sorbet", "zaibatsu", "wildcharm", "default",
chrisgrieser marked this conversation as resolved.
Show resolved Hide resolved
}
colors = vim.tbl_filter(function(color)
return not vim.tbl_contains(builtins, color)
end, colors)
end

local previewer
if opts.enable_preview then
-- define previewer
Expand Down
1 change: 1 addition & 0 deletions lua/telescope/builtin/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ builtin.buffers = require_on_exported_call("telescope.builtin.__internal").buffe
---@param opts table: options to pass to the picker
---@field colors table: a list of additional colorschemes to explicitly make available to telescope (default: {})
---@field enable_preview boolean: if true, will preview the selected color
---@field ignore_builtins boolean: if true, builtin colorschemes are not listed
builtin.colorscheme = require_on_exported_call("telescope.builtin.__internal").colorscheme

--- Lists vim marks and their value, jumps to the mark on `<cr>`
Expand Down