-- In your init.lua or after lazy setup
vim.opt.termguicolors = true

local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    "--branch=stable", -- latest stable release
    lazypath,
  })
end
vim.opt.rtp:prepend(lazypath)

-- Enable spell check for mail files
vim.api.nvim_create_autocmd("FileType", {
  pattern = "mail",
  callback = function()
    vim.opt_local.spell = true
    vim.opt_local.spelllang = "en_us,de" -- Add languages you need
  end,
})
-- Only enable spell checking for specific filetypes
vim.api.nvim_create_autocmd("FileType", {
  pattern = { "mail", "markdown", "text", "gitcommit", "tex", "plaintext" },
  callback = function()
    vim.opt_local.spell = true
    vim.opt_local.spelllang = "en_us,de"
  end,
})

vim.filetype.add({
  extension = {
    tex = "tex",
  },
})

require("vim-options")

-- SINGLE lazy.setup call - combine everything here
require("lazy").setup({
  -- Load plugins from the plugins directory
  { import = "plugins" },
})

require("lualine").setup({
  sections = {
    lualine_x = {
      {
        require("noice").api.statusline.mode.get,
        cond = require("noice").api.statusline.mode.has,
        color = { fg = "#ff9e64" },
      },
    },
  },
})

-- In your init.lua or after lazy setup
local theme_file = vim.fn.stdpath("config") .. "/lua/current_theme.lua"
if vim.fn.filereadable(theme_file) == 1 then
  dofile(theme_file)
else
  vim.cmd.colorscheme("catppuccin") -- fallback
end

vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
vim.api.nvim_set_hl(0, "NormalNC", { bg = "none" })
vim.api.nvim_set_hl(0, "SignColumn", { bg = "none" })
vim.api.nvim_set_hl(0, "FloatBorder", { bg = "none" })
vim.api.nvim_set_hl(0, "LineNr", { bg = "none" })
