nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom highlights get removed when opening the colorscheme picker

KriBielinski opened this issue · comments

Description

When opening the colorscheme picker with telescope and then closing that picker without selecting any colorscheme, any custom highlights that have been previously applied get cleared.

Note: After testing I have noticed that this problem only exists on the 0.1.x release branch. When I switch to the master branch it seems that that problem has already been fixed. So the solution could possibly just be merged from the master branch.

Neovim version

NVIM v0.11.0-dev-1079+g7bf3a616e1
Build type: Release
LuaJIT 2.1.1727870382

Operating system and version

Distro: Linux Mint 21 Vanessa, base: Ubuntu 22.04 jammy

Telescope version / branch / rev

telescope 0.1.x

checkhealth telescope

Checking for required plugins ~
- OK plenary installed.
- WARNING nvim-treesitter not found. (Required for `:Telescope treesitter`.)

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- WARNING fd: not found. Install [sharkdp/fd](https://github.com/sharkdp/fd) for extended capabilities

===== Installed extensions =====

Steps to reproduce

  1. nvim -nu minimal.lua to open Neovim
  2. :lua vim.api.nvim_set_hl(0, 'NORMAL', {fg = 'blue'}) to change highlight of an already existing highlight group.
  3. :lua vim.api.nvim_set_hl(0, 'Custom', {fg = 'red'}) to create a completely custom highlight group.
  4. :Telescope colorscheme to open the colorscheme picker.
  5. <C-c> to close the colorscheme picker without selecting any theme.

Expected behavior

After closing the colorscheme picker, all of the highlight settings should be the same as before opening said picker.

Actual behavior

Both existing and custom highlight groups get cleared to their default values.

Minimal config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    branch = "0.1.x",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})