add transperancy to this lunarvim config and any plugins you think would improve my workflow keep the existing keybindings and refactor with good documentation -- ======================================
-- =========== General Settings =========
-- ======================================

-- Set the leader key to space (default)
vim.g.mapleader = " "

-- Set log level
lvim.log.level = "warn"

-- Enable format on save
lvim.format_on_save.enabled = true

-- Default colorscheme (will be overridden if theme is saved)
local default_colorscheme = "lunar"

-- ======================================
-- ========= Plugin Configurations ======
-- ======================================

-- List of plugins
lvim.plugins = {
  -- Existing plugins...
  {
    "VonHeikemen/lsp-zero.nvim",
    branch = "v2.x",
    dependencies = {
      { "neovim/nvim-lspconfig" },
      { "williamboman/mason.nvim" },
      { "williamboman/mason-lspconfig.nvim" },
      { "hrsh7th/nvim-cmp" },
      { "hrsh7th/cmp-nvim-lsp" },
      { "L3MON4D3/LuaSnip" },
    }
  },
  "hrsh7th/cmp-buffer",
  "hrsh7th/cmp-path",
  "saadparwaiz1/cmp_luasnip",
  "hrsh7th/cmp-nvim-lua",

  -- Existing Python plugins...
  { "nvim-treesitter/nvim-treesitter-textobjects" },
  { "mfussenegger/nvim-dap-python" },
  { "rcarriga/nvim-dap-ui" },
  { "nvim-neotest/neotest" },
  { "nvim-neotest/neotest-python" },
  { "tpope/vim-fugitive" },
  { "folke/trouble.nvim" },
  { "folke/which-key.nvim" },
  { "williamboman/nvim-lsp-installer" },
  { "ray-x/lsp_signature.nvim" },
  { "lukas-reineke/indent-blankline.nvim" },
  { "Vimjas/vim-python-pep8-indent" },
  { "psf/black" },
  { "RRethy/vim-illuminate" },
  { "nvim-lua/plenary.nvim" },
  { "nvim-neotest/nvim-nio" },

  -- JavaScript and web development plugins...
  { "pangloss/vim-javascript" },
  { "maxmellon/vim-jsx-pretty" },
  { "leafgarland/typescript-vim" },
  { "peitalin/vim-jsx-typescript" },
  { "styled-components/vim-styled-components" },
  { "mattn/emmet-vim" },
  { "ap/vim-css-color" },

  -- Codeium AI
  {
    "Exafunction/codeium.vim",
    event = "BufEnter",
    config = function()
      vim.g.codeium_disable_bindings = 1
      vim.keymap.set('i', '<C-f>', function() return vim.fn['codeium#Accept']() end, { expr = true })
      vim.keymap.set('i', '<c-;>', function() return vim.fn['codeium#CycleCompletions'](1) end, { expr = true })
      vim.keymap.set('i', '<c-,>', function() return vim.fn['codeium#CycleCompletions'](-1) end, { expr = true })
      vim.keymap.set('i', '<c-x>', function() return vim.fn['codeium#Clear']() end, { expr = true })
    end
  },

  -- FZF-Lua Plugin for Fuzzy Finding
  {
    "ibhagwan/fzf-lua",
    dependencies = { "nvim-tree/nvim-web-devicons" }, -- Updated from 'requires' to 'dependencies'
    config = function()
      require('fzf-lua').setup {
        -- Optional: Customize FZF-Lua settings here
      }
    end
  },

  -- Theme Plugins (Optional: Add desired themes)
  {
    "folke/tokyonight.nvim",
    -- Optional: Configure the theme if needed
  },
  {
    "gruvbox-community/gruvbox",
    -- Optional: Configure the theme if needed
  },
  {
    "EdenEast/nightfox.nvim",
    -- Optional: Configure the theme if needed
  },

  -- Git Signs
  {
    "lewis6991/gitsigns.nvim",
    config = function()
      require('gitsigns').setup {
        signs = {
          add = { text = '+' },
          change = { text = '~' },
          delete = { text = '_' },
          topdelete = { text = '‾' },
          changedelete = { text = '~' },
        },
        on_attach = function(bufnr)
          local gs = package.loaded.gitsigns

          local function map(mode, l, r, opts)
            opts = opts or {}
            opts.buffer = bufnr
            vim.keymap.set(mode, l, r, opts)
          end

          -- Navigation
          map('n', ']c', function()
            if vim.wo.diff then return ']c' end
            vim.schedule(function() gs.next_hunk() end)
            return '<Ignore>'
          end, { expr = true })

          map('n', '[c', function()
            if vim.wo.diff then return '[c' end
            vim.schedule(function() gs.prev_hunk() end)
            return '<Ignore>'
          end, { expr = true })

          -- Actions
          map('n', '<leader>hs', gs.stage_hunk)
          map('v', '<leader>hs', function() gs.stage_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
          map('n', '<leader>hu', gs.undo_stage_hunk)
          map('n', '<leader>hr', gs.reset_hunk)
          map('v', '<leader>hr', function() gs.reset_hunk { vim.fn.line('.'), vim.fn.line('v') } end)
          map('n', '<leader>hR', gs.reset_buffer)
          map('n', '<leader>hp', gs.preview_hunk)
          map('n', '<leader>hb', function() gs.blame_line { full = true } end)

          -- Text object
          map('o', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
          map('x', 'ih', ':<C-U>Gitsigns select_hunk<CR>')
        end,
      }
    end
  },

  -- Statusline
  {
    "nvim-lualine/lualine.nvim",
    dependencies = { "nvim-tree/nvim-web-devicons", opt = true },
    config = function()
      require('lualine').setup {
        options = {
          icons_enabled = true,
          theme = 'auto',
          component_separators = { left = '', right = '' },
          section_separators = { left = '', right = '' },
          disabled_filetypes = {}
        },
        sections = {
          lualine_a = { 'mode' },
          lualine_b = { 'branch', 'diff', 'diagnostics' },
          lualine_c = { 'filename' },
          lualine_x = { 'encoding', 'fileformat', 'filetype' },
          lualine_y = { 'progress' },
          lualine_z = { 'location' }
        },
        inactive_sections = {
          lualine_a = {},
          lualine_b = {},
          lualine_c = { 'filename' },
          lualine_x = { 'location' },
          lualine_y = {},
          lualine_z = {}
        },
        tabline = {},
        extensions = {}
      }
    end
  },

  -- File Explorer
  {
    "nvim-tree/nvim-tree.lua",
    dependencies = { "nvim-tree/nvim-web-devicons" },
    config = function()
      require('nvim-tree').setup {
        disable_netrw = true,
        hijack_netrw = true,
        open_on_setup = false,
        ignore_ft_on_setup = {},
        auto_close = false,
        open_on_tab = false,
        hijack_cursor = false,
        update_cwd = true,
        diagnostics = {
          enable = true,
          icons = {
            hint = "",
            info = "",
            warning = "",
            error = "",
          },
        },
        update_focused_file = {
          enable = true,
          update_cwd = true,
          ignore_list = {}
        },
        system_open = {
          cmd = nil,
          args = {}
        },
        view = {
          width = 30,
          height = 30,
          hide_root_folder = false,
          side = 'left',
          auto_resize = false,
          mappings = {
            custom_only = false,
            list = {}
          }
        },
      }
    end
  },
}

-- ======================================
-- ======= Load Saved Theme ============
-- ======================================

-- Path to the themes.lua file
local theme_file = vim.fn.stdpath('config') .. '/themes.lua'

-- Function to load the saved theme
local function load_saved_theme()
  local selected_theme = default_colorscheme
  if vim.loop.fs_stat(theme_file) then
    local f = loadfile(theme_file)
    if f then
      local status, result = pcall(f)
      if status and type(result) == "string" then
        selected_theme = result
      else
        print("Error loading theme from themes.lua. Using default theme.")
      end
    else
      print("Unable to load themes.lua. Using default theme.")
    end
  end
  return selected_theme
end

-- Load the theme
local current_theme = load_saved_theme()
lvim.colorscheme = current_theme

-- Handle theme not found error
local success, _ = pcall(vim.cmd, "colorscheme " .. current_theme)
if not success then
  print("Theme '" .. current_theme .. "' not found. Falling back to default theme.")
  lvim.colorscheme = default_colorscheme
  vim.cmd("colorscheme " .. default_colorscheme)
end

-- ======================================
-- ======= LSP and Completion ===========
-- ======================================

-- LSP and completion configuration...
-- (Your existing LSP and completion setup remains unchanged)

local has_lsp_zero, lsp = pcall(require, "lsp-zero")
if has_lsp_zero then
  lsp.preset("recommended")

  lsp.ensure_installed({
    'pyright',
    'tsserver',
    'html',
    'cssls',
  })

  lsp.set_preferences({
    suggest_lsp_servers = false,
    sign_icons = {
      error = 'E',
      warn = 'W',
      hint = 'H',
      info = 'I'
    }
  })

  lsp.on_attach(function(client, bufnr)
    local opts = { buffer = bufnr, remap = false }

    vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
    vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
    vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
    vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
    vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
    vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
    vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
    vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
    vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
    vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
  end)

  lsp.setup()

  local cmp = require('cmp')
  local cmp_select = { behavior = cmp.SelectBehavior.Select }

  cmp.setup({
    sources = {
      { name = 'path' },
      { name = 'nvim_lsp' },
      { name = 'nvim_lua' },
      { name = 'luasnip', keyword_length = 2 },
      { name = 'buffer',  keyword_length = 3 },
    },
    formatting = lsp.cmp_format(),
    mapping = cmp.mapping.preset.insert({
      ['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
      ['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
      ['<C-y>'] = cmp.mapping.confirm({ select = true }),
      ["<C-Space>"] = cmp.mapping.complete(),
    }),
  })
else
  -- Fallback to built-in LSP configuration if lsp-zero is not available
  local lspconfig = require('lspconfig')
  lspconfig.pyright.setup {}
  lspconfig.tsserver.setup {}
  lspconfig.html.setup {}
  lspconfig.cssls.setup {}

  local cmp = require('cmp')
  cmp.setup({
    mapping = cmp.mapping.preset.insert({
      ['<C-b>'] = cmp.mapping.scroll_docs(-4),
      ['<C-f>'] = cmp.mapping.scroll_docs(4),
      ['<C-Space>'] = cmp.mapping.complete(),
      ['<C-e>'] = cmp.mapping.abort(),
      ['<CR>'] = cmp.mapping.confirm({ select = true }),
    }),
    sources = cmp.config.sources({
      { name = 'nvim_lsp' },
      { name = 'buffer' },
    })
  })
end

-- Enable formatters and linters
local linters = require("lvim.lsp.null-ls.linters")
linters.setup({
  { command = "flake8", filetypes = { "python" } },
  { command = "eslint", filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact" } },
})

local formatters = require("lvim.lsp.null-ls.formatters")
formatters.setup({
  { command = "black",    filetypes = { "python" } },
  { command = "prettier", filetypes = { "javascript", "typescript", "javascriptreact", "typescriptreact", "html", "css" } },
})

-- Configure debugger
local dap_python = require('dap-python')
dap_python.setup('~/.virtualenvs/debugpy/bin/python')

-- Configure testing
require("neotest").setup({
  adapters = {
    require("neotest-python")({
      dap = { justMyCode = false },
    }),
  },
})

-- ======================================
-- ========= Key Mappings ===============
-- ======================================

-- Existing key mappings
lvim.keys.normal_mode["<leader>t"] = ":Neotest run<CR>"
lvim.keys.normal_mode["<leader>T"] = ":Neotest run file<CR>"
lvim.keys.normal_mode["<leader>d"] = ":lua require'dap'.toggle_breakpoint()<CR>"
lvim.keys.normal_mode["<leader>D"] = ":lua require'dap'.continue()<CR>"
lvim.keys.normal_mode["<C-a>"] = ":bn<CR>"
lvim.keys.normal_mode["<C-s>"] = ":bp<CR>"

-- Add key mapping for Theme Picker
lvim.keys.normal_mode["<leader>th"] = ":ThemePicker<CR>"

-- Add key mapping for FZF File Picker
lvim.keys.normal_mode["<leader>f"] = ":File<CR>"

-- Additional key mappings for new features
-- Toggle Nvim Tree
lvim.keys.normal_mode["<C-n>"] = ":NvimTreeToggle<CR>"

-- ======================================
-- ======== Custom Commands ==============
-- ======================================

-- ============================
-- === Custom Theme Picker ===
-- ============================

-- Create a custom command to pick themes using Telescope
vim.api.nvim_create_user_command('ThemePicker', function()
  local has_telescope, telescope = pcall(require, 'telescope.builtin')
  if not has_telescope then
    print("Telescope is not installed")
    return
  end

  telescope.colorscheme({
    enable_preview = true,
    shorten_path = true,
    attach_mappings = function(_, map)
      map('i', '<CR>', function(prompt_bufnr)
        local actions = require('telescope.actions')
        local action_state = require('telescope.actions.state')
        actions.close(prompt_bufnr)

        local selection = action_state.get_selected_entry()
        if selection and selection.value then
          -- Set the colorscheme
          lvim.colorscheme = selection.value
          vim.cmd('colorscheme ' .. selection.value)

          -- Save the selected theme to themes.lua
          local theme_path = vim.fn.stdpath('config') .. '/themes.lua'
          local file = io.open(theme_path, 'w')
          if file then
            file:write('return "' .. selection.value .. '"')
            file:close()
            print("Theme set to " .. selection.value)
          else
            print("Error: Unable to write to themes.lua")
          end
        end
      end)
      return true
    end
  })
end, {})

-- ============================
-- === Custom FZF Command ====
-- ============================

-- Create a custom command `:File` to open the FZF file picker
vim.api.nvim_create_user_command('File', function()
  require('fzf-lua').files()
end, {})

-- ======================================
-- ========= Additional Settings ========
-- ======================================

-- Enable relative line numbers
vim.opt.relativenumber = true

-- Disable line wrapping
vim.opt.wrap = false

-- Use 2 spaces for JavaScript, TypeScript, HTML, and CSS
vim.api.nvim_create_autocmd("FileType", {
  pattern = { "javascript", "javascriptreact", "typescript", "typescriptreact", "html", "css" },
  callback = function()
    vim.opt_local.tabstop = 2
    vim.opt_local.shiftwidth = 2
    vim.opt_local.expandtab = true
  end
})

-- Use 4 spaces for Python
vim.api.nvim_create_autocmd("FileType", {
  pattern = "python",
  callback = function()
    vim.opt_local.tabstop = 4
    vim.opt_local.shiftwidth = 4
    vim.opt_local.expandtab = true
  end
})

-- ======================================
-- ========== Nice-to-Have Features ======
-- ======================================

-- 1. Git Signs (Already added above)

-- 2. Statusline (Already added above with lualine.nvim)

-- 3. File Explorer (Already added above with nvim-tree.lua)

-- Feel free to customize these plugins further based on your preferences.

-- ======================================
-- ======== Final Notes ==================
-- ======================================

-- Make sure to run :PackerSync or restart LunarVim after updating the configuration
-- to install the new plugins.

-- To use the new features:
-- - **Theme Picker:** Press `<leader>th` (usually `<Space>th`) or run `:ThemePicker`
-- - **FZF File Picker:** Press `<leader>f` or run `:File`
-- - **Toggle File Explorer:** Press `<C-n>` (Ctrl + n) to toggle the file explorer

-- ####################################################
-- == End of Updated config.lua ======================
-- ####################################################