vim.cmd("set expandtab")
vim.cmd("set tabstop=2")
vim.cmd("set softtabstop=2")
vim.cmd("set shiftwidth=2")
vim.g.mapleader = " "
vim.g.maplocalleader = ","
vim.g.background = "light"

vim.opt.swapfile = false

-- Navigate vim panes better
vim.keymap.set("n", "<c-k>", ":wincmd k<CR>")
vim.keymap.set("n", "<c-j>", ":wincmd j<CR>")
vim.keymap.set("n", "<c-h>", ":wincmd h<CR>")
vim.keymap.set("n", "<c-l>", ":wincmd l<CR>")

vim.keymap.set("n", "<leader>h", ":nohlsearch<CR>")
vim.wo.number = true

-- latex pdf compile and live preview
-- vimtex already provides these — just map them to your preferred keys
vim.keymap.set("n", "<leader>lc", "<cmd>VimtexCompile<CR>", { desc = "Compile LaTeX (toggle)" })
vim.keymap.set("n", "<leader>lv", "<cmd>VimtexView<CR>", { desc = "View PDF in Zathura" })
vim.keymap.set("n", "<leader>le", "<cmd>VimtexErrors<CR>", { desc = "Show errors" })
vim.keymap.set("n", "<leader>lk", "<cmd>VimtexStop<CR>", { desc = "Stop compiler" })
vim.keymap.set("n", "<leader>lK", "<cmd>VimtexStopAll<CR>", { desc = "Stop all compilers" })
vim.keymap.set("n", "<leader>lx", "<cmd>VimtexClean<CR>", { desc = "Clean aux files" })
vim.keymap.set("n", "<leader>lt", "<cmd>VimtexTocToggle<CR>", { desc = "Toggle TOC" })
-- vim.keymap.set("n", "<leader>lc", ":!pdflatex %<CR>", { desc = "Compile LaTeX" })
-- vim.keymap.set("n", "<leader>lv", ":!zathura %:r.pdf &<CR>", { desc = "View PDF" })
-- vim.g.vimtex_fold_enabled = 1
-- vim.g.vimtex_fold_types = {
--   sections = {
--     parse_levels = 1,
--     sections = { "section", "subsection", "subsubsection" },
--   },
--   envs = {
--     blacklist = { "document" },
--   },
-- }
-- -- vimtex knows these environment names and will expand them fully
-- vim.g.vimtex_complete_enabled = 1
-- vim.g.vimtex_complete_close_braces = 1

vim.o.foldcolumn = "1" -- small gutter with +/- signs
vim.o.foldlevel = 99 -- start with all folds open
vim.o.foldlevelstart = 99
vim.o.foldtext = "" -- use default line
