Skip to content

Commit

Permalink
feat(builtin.colorscheme): add option ignore_builtins (#3155)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisgrieser committed Jun 15, 2024
1 parent 19584e6 commit 77cab9a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
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 = {
"blue", "darkblue", "default", "delek", "desert", "elflord", "evening",
"habamax", "industry", "koehler", "lunaperche", "morning", "murphy",
"pablo", "peachpuff", "quiet", "retrobox", "ron", "shine", "slate",
"sorbet", "torte", "vim", "wildcharm", "zaibatsu", "zellner",
}
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

0 comments on commit 77cab9a

Please sign in to comment.