diff options
Diffstat (limited to '.config/nvim/lua/plugins/lushwal.lua')
| -rw-r--r-- | .config/nvim/lua/plugins/lushwal.lua | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/lushwal.lua b/.config/nvim/lua/plugins/lushwal.lua new file mode 100644 index 0000000..94c5681 --- /dev/null +++ b/.config/nvim/lua/plugins/lushwal.lua @@ -0,0 +1,119 @@ +local function apply_transparent_overrides() + local hl = vim.api.nvim_set_hl + local none = "NONE" + hl(0, "Normal", { bg = none }) + hl(0, "NormalFloat", { bg = none }) + hl(0, "FloatBorder", { bg = none }) + hl(0, "EndOfBuffer", { bg = none }) + hl(0, "CursorLine", { bg = none }) + hl(0, "LineNr", { bg = none }) + hl(0, "SignColumn", { bg = none }) + hl(0, "Pmenu", { bg = none }) + hl(0, "PmenuSel", { bg = none }) + hl(0, "TelescopeNormal", { bg = none }) + hl(0, "TelescopeBorder", { bg = none }) +end + +local function set_transparent(on) + vim.g.lushwal_transparent = on + if on then + apply_transparent_overrides() + else + -- Restore theme defaults (pywal colors with solid background) + vim.cmd("colorscheme lushwal") + end + vim.notify( + (on and "Transparency on" or "Transparency off"), + vim.log.levels.INFO, + { title = "Lushwal" } + ) +end + +local function toggle_transparent() + set_transparent(vim.g.lushwal_transparent ~= true) +end + +return { + { + "oncomouse/lushwal.nvim", + cmd = { "LushwalCompile" }, + dependencies = { + { "rktjmp/lush.nvim" }, + { "rktjmp/shipwright.nvim" }, + }, + lazy = false, + init = function() + -- Solid background by default (pywal colors). Run :LushwalCompile once after this change to regenerate the theme. + vim.g.lushwal_configuration = { + transparent_background = false, + } + end, + config = function() + vim.g.lushwal_transparent = false -- off by default + vim.api.nvim_create_user_command("LushwalToggleTransparency", toggle_transparent, {}) + vim.keymap.set("n", "<leader>ut", toggle_transparent, { desc = "Toggle transparency" }) + -- Re-apply transparent overrides after colorscheme load when user had transparency on + vim.api.nvim_create_autocmd("ColorScheme", { + pattern = "lushwal", + callback = function() + if vim.g.lushwal_transparent then + apply_transparent_overrides() + else + -- Softer cursor line so the active line doesn't overpower the text + vim.api.nvim_set_hl(0, "CursorLine", { bg = "#252530", fg = "NONE" }) + end + end, + }) + -- Apply subtle CursorLine on first load (non-transparent default) + vim.defer_fn(function() + if vim.g.colors_name == "lushwal" and not vim.g.lushwal_transparent then + vim.api.nvim_set_hl(0, "CursorLine", { bg = "#252530", fg = "NONE" }) + end + end, 10) + end, + }, + -- Add project.nvim for better project management + { + "ahmedkhalf/project.nvim", + keys = { + { "<leader>fp", "<Cmd>Telescope projects<CR>", desc = "Find Projects" }, + }, + config = function() + require("project_nvim").setup({ + -- Path where to store the project history for telescope + datapath = vim.fn.stdpath("data"), + -- Detection methods for projects + detection_methods = { "pattern", "lsp" }, + -- Patterns used to detect projects + patterns = { + ".git", + "_darcs", + ".hg", + ".bzr", + ".svn", + "Makefile", + "package.json", + "Cargo.toml", + "requirements.txt", + "pyproject.toml", + "go.mod", + "composer.json", + "Gemfile", + ".lazy.lua", + }, + -- Only consider these directories as projects + scope_chdir = "tab", + -- What to do when changing project + silent_chdir = false, + }) + require("telescope").load_extension("projects") + end, + }, + -- Configure LazyVim to load lushwal + { + "LazyVim/LazyVim", + opts = { + colorscheme = "lushwal", + }, + }, +} |
