Files
nvim-configs/lua/options.lua
2025-09-13 02:09:53 +02:00

57 lines
1.6 KiB
Lua
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

require "nvchad.options"
-- Set global options
vim.o.cursorlineopt ='both' -- to enable cursorline!
vim.o.scrolloff = 10
vim.opt.relativenumber = true
vim.g.wiki_root = "~/wiki"
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
-- Set vimtex options
vim.g.tex_flavour = "latex"
vim.g.vimtex_view_method = "skim"
vim.g.vimtex_view_skim_reading_bar = 1
vim.g.vimtex_view_skim_sync = 1
-- vim.g.vimtex_quickfix_mode = 0
vim.g.vimtex_compiler_method = "latexmk"
vim.g.vimtex_mappings_prefix = "å"
vim.g.complete_close_brackets = 1
-- Set luasnip path
local snippets = require "luasnip.loaders.from_lua"
snippets.load({ paths = "~/.config/nvim/lua/custom/snippets" })
-- Set window-local options
local highlight_group = vim.api.nvim_create_augroup("yankhighlight", { clear = true })
vim.api.nvim_create_autocmd("textyankpost", {
callback = function()
vim.highlight.on_yank()
end,
group = highlight_group,
pattern = "*",
})
-- Surround
vim.api.nvim_create_autocmd("FileType", {
pattern = "tex",
callback = function()
vim.b.surround_105 = "\\textit{" .. "\n" .. "}"
vim.b.surround_101 = "\\emph{" .. "\n" .. "}"
vim.b.surround_102 = "\\textbf{" .. "\n" .. "}"
end,
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "tex",
callback = function()
-- Set a maximum line width of 88 characters
vim.bo.textwidth = 88
-- Ensure 'formatoptions' includes the 't' flag for text wrapping
vim.bo.formatoptions = vim.bo.formatoptions .. "t"
-- Disable conforms formatter so that gq uses Vims native formatter
vim.bo.formatexpr = ""
end,
})