Add vimtex

This commit is contained in:
salomaestro
2025-03-21 01:27:49 +01:00
parent 71da2ca93d
commit a61d76d248
3 changed files with 58 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
local ls = require "luasnip"
local s = ls.snippet
local t = ls.text_node
local i = ls.insert_node
return {
-- Italic snippet: type "it" in insert mode and expand to \textit{...}
s({trig="it", desc="Insert italic text"}, {
t "\\textit{",
i(1, "text"),
t "}",
}),
-- Bold snippet example:
s({trig="bf", desc="Insert bold text"}, {
t "\\textbf{",
i(1, "text"),
t "}",
}),
-- Emph snippet example:
s({trig="em", desc="Insert emphasized text"}, {
t "\\emph{",
i(1, "text"),
t "}",
}),
}

View File

@@ -1,11 +1,27 @@
require "nvchad.options" require "nvchad.options"
-- Set global options
vim.o.cursorlineopt ='both' -- to enable cursorline! vim.o.cursorlineopt ='both' -- to enable cursorline!
vim.o.scrolloff = 10 vim.o.scrolloff = 10
vim.opt.relativenumber = true vim.opt.relativenumber = true
vim.g.wiki_root = "~/wiki" vim.g.wiki_root = "~/wiki"
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" 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 }) local highlight_group = vim.api.nvim_create_augroup("yankhighlight", { clear = true })
vim.api.nvim_create_autocmd("textyankpost", { vim.api.nvim_create_autocmd("textyankpost", {
callback = function() callback = function()
@@ -15,6 +31,7 @@ vim.api.nvim_create_autocmd("textyankpost", {
pattern = "*", pattern = "*",
}) })
-- dap
require "dap" require "dap"
local sign = vim.fn.sign_define local sign = vim.fn.sign_define
@@ -33,3 +50,14 @@ vim.api.nvim_create_autocmd("QuickFixCmdPost", {
end, end,
pattern = "*", 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,
})

View File

@@ -36,6 +36,11 @@ return {
lazy = false, lazy = false,
}, },
{
"lervag/vimtex",
lazy = false,
},
{ {
"jay-babu/mason-nvim-dap.nvim", "jay-babu/mason-nvim-dap.nvim",
opts = { opts = {