Skip to content

Commit

Permalink
feat(colorschemes): active colorscheme as first entry (closes #1045)
Browse files Browse the repository at this point in the history
  • Loading branch information
ibhagwan committed Feb 21, 2024
1 parent 296ff49 commit d8643f1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lua/fzf-lua/providers/colorschemes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ M.colorschemes = function(opts)
opts = config.normalize_opts(opts, "colorschemes")
if not opts then return end


local current_colorscheme = get_current_colorscheme()
local current_background = vim.o.background
local colors = opts.colors or vim.fn.getcompletion("", "color")
Expand All @@ -34,6 +33,15 @@ M.colorschemes = function(opts)
end, colors)
end

-- make sure active colorscheme is first entry (#1045)
for i, c in ipairs(colors) do
if c == current_colorscheme then
table.remove(colors, i)
table.insert(colors, 1, c)
break
end
end

if opts.live_preview then
-- must add ':nohidden' or fzf ignores the preview action
opts.fzf_opts["--preview-window"] = "nohidden:right:0"
Expand Down

0 comments on commit d8643f1

Please sign in to comment.