andrewberty / telescope-themes

34 stars 2 forks source link

Nvim theme returns to default after set #9

Open mhiuuu opened 6 hours ago

mhiuuu commented 6 hours ago

As I said in the title, every time I set the theme using telescope themes, I would find it comes back to the default theme after quitting Neovim

andrewberty commented 6 hours ago

Hello Mathew, Can you please share your telescope config and your init.lua (or wherever you require) the created file, so we can debug it together?

mhiuuu commented 10 minutes ago

Sure! Here is my telescope.lua

  'nvim-telescope/telescope.nvim',
  event = 'VimEnter',
  branch = '0.1.x',
  dependencies = {
    'nvim-lua/plenary.nvim',
    { 
      'nvim-telescope/telescope-fzf-native.nvim',
      build = 'make',
      cond = function()
        return vim.fn.executable 'make' == 1
      end,
    },
    { "andrew-george/telescope-themes" },
    { 'nvim-tree/nvim-web-devicons', enabled = true },
  },
  config = function()
    local builtin_schemes = require("telescope._extensions.themes").builtin_schemes

    require('telescope').setup {
      defaults = {
        mappings = {
          i = {
            ['<C-k>'] = require('telescope.actions').move_selection_previous, -- move to prev result
            ['<C-j>'] = require('telescope.actions').move_selection_next, -- move to next result
            ['<CR>'] = require('telescope.actions').select_default, -- open file
          },
        },
      },
      pickers = {
        find_files = {
          file_ignore_patterns = { 'node_modules', '.git', '.venv' },
          hidden = true,
        },
      },
      live_grep = {
        file_ignore_patterns = { 'node_modules', '.git', '.venv' },
        additional_args = function(_)
          return { '--hidden' }
        end,
      },
      extensions = {
        themes = {
          layout_config = {
            horizontal = {
              width = 0.8,
              height = 0.7,
            },
          },
          enable_previewer = true,
          enable_live_preview = true,
          ignore = vim.list_extend(builtin_schemes, { "embark" }),
          light_themes = {
            ignore = true,
            keywords = { "light", "day", "frappe" }
          },
          dark_themes = {
            ignore = false,
            keywords = { "dark", "night", "black" }
          },
          persist = {
            enabled = true,
            path = vim.fn.stdpath("config") .. "/lua/colorscheme.lua"
          },
          mappings = {
            down = "<C-n>",
            up = "<C-p>",
            accept = "<C-y>",
          },
        },
      },
    }

    -- Enable Telescope extensions if they are installed
    pcall(require('telescope').load_extension, 'fzf')
    pcall(require('telescope').load_extension, 'themes')
  end,
}

and this is init.lua

require 'core.options'
require 'core.keymaps'

local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
if not (vim.uv or vim.loop).fs_stat(lazypath) then
  local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
  local out = vim.fn.system { 'git', 'clone', '--filter=blob:none', '--branch=stable', lazyrepo, lazypath }
  if vim.v.shell_error ~= 0 then
    error('Error cloning lazy.nvim:\n' .. out)
  end
end
vim.opt.rtp:prepend(lazypath)
require('lazy').setup({
    require 'plugins.nvimtree',
    require 'plugins.lualine',
    require 'plugins.bufferline',
    require 'plugins.treesitter',
    require 'plugins.telescope',
    require 'plugins.lsp_config',
    require 'plugins.autocompletion',
    require 'plugins.gitsigns',
    require 'plugins.indent_line',
    require 'plugins.more',
    require 'plugins.startup',
    require 'plugins.term',
    require 'plugins.themes'
})

vim.cmd[[colorscheme tokyonight]]  -- this is added manually to use the tokyonight theme

This is the screencast after I removed the manually added line

https://github.com/user-attachments/assets/88659a97-bde8-4263-a3e1-2844b496cd72