Skip to content

Commit

Permalink
feat(builtin.colorscheme): allow picking colors not yet loaded by Laz…
Browse files Browse the repository at this point in the history
…y.nvim
  • Loading branch information
mehalter committed Sep 16, 2024
1 parent 54be38f commit ed9926a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lua/telescope/builtin/__internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1008,6 +1008,19 @@ internal.colorscheme = function(opts)
end, vim.fn.getcompletion("", "color"))
)

-- if lazy is available, extend the colors list with unloaded colorschemes
local lazy = package.loaded["lazy.core.util"]
if lazy and lazy.get_unloaded_rtp then
local paths = lazy.get_unloaded_rtp ""
local all_files = vim.fn.globpath(table.concat(paths, ","), "colors/*", 1, 1)
for _, f in ipairs(all_files) do
local color = vim.fn.fnamemodify(f, ":t:r")
if not vim.tbl_contains(colors, color) then
table.insert(colors, color)
end
end
end

if opts.ignore_builtins then
-- stylua: ignore
local builtins = {
Expand Down

0 comments on commit ed9926a

Please sign in to comment.