Skip to content

[Colorschemes] How to remove unwanted item from the list of colorschemes. #3695

Closed Answered by iamxiaojianzheng
iamxiaojianzheng asked this question in Q&A
Discussion options

You must be logged in to vote

Based on your code, I implemented this idea that you are really cool.

local get_colorsheme = function()
  local builtins = {}

  for name, _ in vim.fs.dir("$VIMRUNTIME/colors/") do
    if name:match("*.txt") then
      break
    else
      name = name:match("(.*).lua$") or name:match("(.*).vim$")
      table.insert(builtins, name)
    end
  end
  local target = vim.fn.getcompletion

  ---@diagnostic disable-next-line: duplicate-set-field
  vim.fn.getcompletion = function()
    return vim.tbl_filter(function(color)
      return not vim.tbl_contains(builtins, color)
      ---@diagnostic disable-next-line: param-type-mismatch
    end, target("", "color"))
  end

  LazyVim.pick("colorschemes")…

Replies: 3 comments 9 replies

Comment options

You must be logged in to vote
1 reply
@iamxiaojianzheng
Comment options

Answer selected by iamxiaojianzheng
Comment options

You must be logged in to vote
4 replies
@dpetka2001
Comment options

@iamxiaojianzheng
Comment options

@dpetka2001
Comment options

@iamxiaojianzheng
Comment options

Comment options

You must be logged in to vote
4 replies
@dpetka2001
Comment options

@dpetka2001
Comment options

@abeldekat
Comment options

@dpetka2001
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants