-- Autocmds are automatically loaded on the VeryLazy event -- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua -- Add any additional autocmds here -- vim.cmd("let &t_ut=''") vim.opt_local.breakindent = true vim.opt_local.wrap = true local md_tex = function() -- vim.cmd("syn region markdownMathInline matchgroup=texMathZone start=/$/ end=/$/ contains=@texMath") -- vim.cmd("syn match markdownMathInline '$[^$].{-}$' contains=@texMath") -- vim.cmd("syn region markdownMathBlock matchgroup=texMathZone start=/$$/ end=/$$/ contains=@texMath") -- vim.cmd("syn include @texMath syntax/tex.vim") -- Include the tex syntax for use within markdown vim.cmd("syntax include @tex syntax/tex.vim") -- Define the inline math region and allow it to contain tex syntax vim.cmd("syntax region texMathZone start=/\\$/ end=/\\$/ contained contains=@tex") -- Define the display math region and allow it to contain tex syntax vim.cmd("syntax region texMathDisplay start=/\\$\\$/ end=/\\$\\$/ contained contains=@tex") -- Optionally, conceal the `$` symbols for cleaner display vim.opt.conceallevel = 2 vim.cmd("syntax region texMathZone start=/\\$/ skip=/\\\\\\$/ end=/\\$/ concealends contained") vim.cmd("syntax region texMathDisplay start=/\\$\\$/ end=/\\$\\$/ concealends contained") end vim.api.nvim_create_autocmd({ "FileType" }, { pattern = { "markdown" }, callback = function() vim.opt_local.breakindent = true vim.opt_local.wrap = true vim.opt_local.spell = true -- local secondary = "#379393" -- local primary = "#933737" local colorbuddy = require("colorbuddy") local colors = colorbuddy.colors vim.api.nvim_set_hl(0, "ObsidianRefText", { fg = colors.secondary:to_vim(), bold = true, underline = true }) vim.api.nvim_set_hl(0, "ObsidianRef", { fg = colors.secondary:to_vim(), bold = true, underline = true }) vim.api.nvim_set_hl(0, "ObsidianBullet", { fg = colors.complement:to_vim(), bold = true, underline = false }) vim.api.nvim_set_hl(0, "ObsidianDone", { fg = colors.complement:to_vim(), bold = true, underline = false }) vim.api.nvim_set_hl(0, "ObsidianTodo", { fg = colors.complement:to_vim(), bold = true, underline = false }) vim.api.nvim_set_hl(0, "obsidiantag", { fg = colors.complement:to_vim(), bold = false, italic = true }) vim.api.nvim_set_hl(0, "ObsidianTag", { fg = colors.complement:to_vim(), bold = false, italic = true }) -- vim.api.nvim_buf_set_keymap(0, "n", "mc", "gzaiW`", { desc = "Markdown: add Code Surround", silent = true }) -- vim.api.nvim_buf_set_keymap(0, "n", "", "normal! zz", { remap = false }) -- vim.api.nvim_buf_set_keymap(0, "n", "", "normal! zz", { remap = false }) -- vim.api.nvim_buf_set_keymap( -- 0, -- "n", -- "mr", -- "gzd`", -- { desc = "Markdown: delete Code Surround", silent = true } -- ) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "__", -- { desc = "Markdown: Italics", noremap = true, silent = true } -- ) -- vim.api.nvim_buf_set_keymap(0, "i", "", "- [ ] ", { desc = "Markdown: Task", noremap = true, silent = true }) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "I# ", -- { desc = "Markdown: Heading", noremap = true, silent = true } -- ) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "I## ", -- { desc = "Markdown: Heading", noremap = true, silent = true } -- ) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "I### ", -- { desc = "Markdown: Heading", noremap = true, silent = true } -- ) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "I#### ", -- { desc = "Markdown: Heading", noremap = true, silent = true } -- ) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "I##### ", -- { desc = "Markdown: Heading", noremap = true, silent = true } -- ) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "****", -- { desc = "Markdown: Bold", noremap = true, silent = true } -- ) -- vim.api.nvim_buf_set_keymap( -- 0, -- "i", -- "", -- "I- ", -- { desc = "Markdown: Bullet Point", noremap = true, silent = true } -- ) -- local wk = require("which-key") -- wk.add({ -- { "", mode = "i", desc = "Markdown Italics" }, -- { "", mode = "i", desc = "Markdown Bold" }, -- }) end, })