doctorfree / nvim-lazyman

Neovim configuration manager and Lazy/Lua/Mason based Neovim config. Manage multiple Neovim configurations with the lazyman command. ☕
https://lazyman.dev
MIT License
280 stars 8 forks source link

Theme chooser for lazyman config. #60

Open wxguy opened 9 months ago

wxguy commented 9 months ago

The official documentation says that it supports "catppuccin, tokyonight, nightfox, tundra, dracula, kanagawa, onedarkpro, everforest, monokai-pro" themes. But there is no mention of choosing a theme from config.

I propose that you should use themery plugin within lazyman config so that useres can use keybinding to view, preview and select theme of their choice. Here is my themes.lua file that contains all the themes:-

return {
    {
        "projekt0n/github-nvim-theme",
        lazy = false,
        --event = "VeryLazy",
        priority = 1000,

        config = function()
            require("github-theme").setup({})
        end,
        --cond = false,
    },
    {
        "tanvirtin/monokai.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function()
            require("monokai").setup({})
        end,
        --cond = false,
    },
    {
        "Allianaab2m/penumbra.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function()
            require("penumbra").setup({})
        end,
        --cond = false,
    },
    {
        "folke/tokyonight.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,
        opts = {},
        --cond = false,
    },
    {
        "kihachi2000/yash.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        --cond = false,
    },
    {
        "EdenEast/nightfox.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function()
            require("nightfox").setup({})
        end,
        --cond = false,
    },
    {
        "tiagovla/tokyodark.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function()
            require("tokyodark").setup({})
        end,
        --cond = false,
    },
    {
        "loctvl842/monokai-pro.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function()
            require("monokai-pro").setup({})
        end,
        --cond = false,
    },
    {
        -- NOTE: duplicate
        "crusoexia/vim-monokai",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function() end,
        cond = false,
    },
    {
        "sainnhe/sonokai",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function()
            vim.g.sonokai_style = "default"
        end,
        --cond = false,
    },
    {
        "voidekh/kyotonight.vim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        --cond = false,
    },
    {
        "shaunsingh/nord.nvim",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        --cond = false,
    },
    {
        "catppuccin/nvim",
        name = "catppuccin",
        --lazy = false,
        --event = "VeryLazy",
        priority = 1000,

        config = function()
            require("catppuccin").setup({})
        end,
        --cond = false,
    },
    {
        "kyoh86/momiji",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        --cond = false,
    },
    {
        "sainnhe/edge",
        --lazy = false,
        --event = "VeryLazy",
        --priority = 1000,

        config = function()
            vim.g.edge_style = "default"
            vim.g.edge_better_performance = 1
        end,
        --cond = false,
    },
}

Here is my themery.lua file to choose a theme:

local path_sep = "/"
local themery_config = vim.fn.stdpath("config")
    .. path_sep
    .. "lua"
    .. path_sep
    .. "config"
    .. path_sep
    .. "colorscheme.lua"
return {
    "zaldih/themery.nvim",
    --lazy = false,
    --event = "VeryLazy",
    cmd = "Themery",
    config = function()
        local status_ok, themery = pcall(require, "themery")
        if not status_ok then
            return
        end
        themery.setup({
            themes = {
                {
                    name = "github-nvim-theme",
                    colorscheme = "github_dark",
                },
                {
                    name = "momiji",
                    colorscheme = "momiji",
                },
                {
                    name = "monokai-pro.nvim",
                    colorscheme = "monokai-pro",
                },
                {
                    name = "monokai.nvim",
                    colorscheme = "monokai",
                },
                {
                    name = "nightfox.nvim",
                    colorscheme = "nightfox",
                },
                {
                    name = "nord.nvim",
                    colorscheme = "nord",
                },
                {
                    name = "penumbra.nvim",
                    colorscheme = "penumbra",
                },
                {
                    name = "sonokai",
                    colorscheme = "sonokai",
                },
                {
                    name = "tokyodark.nvim",
                    colorscheme = "tokyodark",
                },
                {
                    name = "tokyonight.nvim",
                    colorscheme = "tokyonight",
                },
                {
                    name = "yash.nvim",
                    colorscheme = "yash",
                },
                {
                    name = "catppuccin",
                    colorscheme = "catppuccin",
                },
                {
                    name = "edge",
                    colorscheme = "edge",
                },
                {
                    name = "kyotonight.vim",
                    colorscheme = "kyotonight",
                },
            },
            themeConfigFile = themery_config,
            livePreview = true,
        })
    end,
    -- cond = false,
}

This gives me the following GUI window to choose themes:

Screenshot from 2023-12-28 17-23-11

Hope it helps you to integrate a new feature for your project.

doctorfree commented 9 months ago

Themery looks cool, I will check it out. Thanks for supplying configuration details.

Currently you can configure the Lazyman colorscheme using the configuration menu (lazyman -F). Theme, style, and transparency can be selected. Or you can just edit thee lua/configuration.lua directly.

Lazyman key bindings are also available - , to bring up the whichkey manu (or whatever is your mapleader) then u to view the UI menu, and c to select coloscheme. This doesn't work as well as I would like so maybe themery would provide improved usage.

The themes Lazyman supports and the way they are supported is coupled with the configuration menus and themes are selected for compatibility with other componenets like lualine so untangling this might be problematic.

This is a good suggestion but may take more effort than I have time. I'll look into it.

doctorfree commented 9 months ago

Also the which-key UI menu supports ,uT to select a theme using the telescope theme switcher.

My first attempt to integrate Themery into the Lazyman config failed with errors loading when I tried the :Themery command and selected a theme. I used your example configs above so I must be missing something.

Given the current support for colorscheme and theme selection using telescope, does incorporation of Themery offer significant value? If we think so, what additional config do I need to perform beyond what you have above?

Still gonna play around with Themery but not sure how best to proceed.