AutoYADM commit: 2025-01-03 10:00:02
This commit is contained in:
parent
e696b7838b
commit
69d28f23ef
5 changed files with 127 additions and 122 deletions
|
@ -51,12 +51,14 @@ vim.api.nvim_create_autocmd("VimEnter", {
|
|||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
if vim.g.md_tex then
|
||||
vim.opt_local.breakindent = true
|
||||
vim.cmd([[
|
||||
local md = false
|
||||
if md then
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
if vim.g.md_tex then
|
||||
vim.opt_local.breakindent = true
|
||||
vim.cmd([[
|
||||
syn region mathBlock start=/\$\$/ end=/\$\$/ contains=@tex
|
||||
" inline math
|
||||
syn match mathInline '\$[^$].\{-}\$' contains=@tex
|
||||
|
@ -65,111 +67,112 @@ vim.api.nvim_create_autocmd("FileType", {
|
|||
hi def link mathBlock Statement
|
||||
hi def link mathInline Statement
|
||||
]])
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "markdown" },
|
||||
callback = function()
|
||||
-- We want markdown files to autosave
|
||||
vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
|
||||
buffer = 0,
|
||||
command = "silent! write",
|
||||
})
|
||||
vim.keymap.set("i", "<Cr>", function()
|
||||
local md_utils = require("md-utils")
|
||||
local isList = md_utils.isCursorInList()
|
||||
if isList then
|
||||
vim.api.nvim_command("MDListItemBelow")
|
||||
else
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, true, true), "n", true)
|
||||
end
|
||||
end, { desc = "Continue List", silent = true, remap = 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", "<leader>mc", "gzaiW`", { desc = "Markdown: add Code Surround", silent = true })
|
||||
-- vim.api.nvim_buf_set_keymap(0, "n", "<M-n>", "<cmd>normal! <M-n>zz<CR>", { remap = false })
|
||||
-- vim.api.nvim_buf_set_keymap(0, "n", "<M-e>", "<cmd>normal! <M-e>zz<CR>", { remap = false })
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "n",
|
||||
-- "<leader>mr",
|
||||
-- "gzd`",
|
||||
-- { desc = "Markdown: delete Code Surround", silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-i>",
|
||||
-- "__<Left>",
|
||||
-- { desc = "Markdown: Italics", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(0, "i", "<M-d>", "- [ ] ", { desc = "Markdown: Task", noremap = true, silent = true })
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-a>",
|
||||
-- "<Esc>I# ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-r>",
|
||||
-- "<Esc>I## ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-s>",
|
||||
-- "<Esc>I### ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-t>",
|
||||
-- "<Esc>I#### ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-g>",
|
||||
-- "<Esc>I##### ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-b>",
|
||||
-- "****<Left><Left>",
|
||||
-- { desc = "Markdown: Bold", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-e>",
|
||||
-- "<Esc>I- ",
|
||||
-- { desc = "Markdown: Bullet Point", noremap = true, silent = true }
|
||||
-- )
|
||||
-- local wk = require("which-key")
|
||||
-- wk.add({
|
||||
-- { "<M-i>", mode = "i", desc = "Markdown Italics" },
|
||||
-- { "<M-b>", mode = "i", desc = "Markdown Bold" },
|
||||
-- })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ "FileType" }, {
|
||||
pattern = { "markdown" },
|
||||
callback = function()
|
||||
-- We want markdown files to autosave
|
||||
vim.api.nvim_create_autocmd({ "InsertLeave", "TextChanged" }, {
|
||||
buffer = 0,
|
||||
command = "silent! write",
|
||||
})
|
||||
vim.keymap.set("i", "<Cr>", function()
|
||||
local md_utils = require("md-utils")
|
||||
local isList = md_utils.isCursorInList()
|
||||
if isList then
|
||||
vim.api.nvim_command("MDListItemBelow")
|
||||
else
|
||||
vim.api.nvim_feedkeys(vim.api.nvim_replace_termcodes("<CR>", true, true, true), "n", true)
|
||||
end
|
||||
end, { desc = "Continue List", silent = true, remap = 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", "<leader>mc", "gzaiW`", { desc = "Markdown: add Code Surround", silent = true })
|
||||
-- vim.api.nvim_buf_set_keymap(0, "n", "<M-n>", "<cmd>normal! <M-n>zz<CR>", { remap = false })
|
||||
-- vim.api.nvim_buf_set_keymap(0, "n", "<M-e>", "<cmd>normal! <M-e>zz<CR>", { remap = false })
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "n",
|
||||
-- "<leader>mr",
|
||||
-- "gzd`",
|
||||
-- { desc = "Markdown: delete Code Surround", silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-i>",
|
||||
-- "__<Left>",
|
||||
-- { desc = "Markdown: Italics", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(0, "i", "<M-d>", "- [ ] ", { desc = "Markdown: Task", noremap = true, silent = true })
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-a>",
|
||||
-- "<Esc>I# ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-r>",
|
||||
-- "<Esc>I## ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-s>",
|
||||
-- "<Esc>I### ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-t>",
|
||||
-- "<Esc>I#### ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-g>",
|
||||
-- "<Esc>I##### ",
|
||||
-- { desc = "Markdown: Heading", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-b>",
|
||||
-- "****<Left><Left>",
|
||||
-- { desc = "Markdown: Bold", noremap = true, silent = true }
|
||||
-- )
|
||||
-- vim.api.nvim_buf_set_keymap(
|
||||
-- 0,
|
||||
-- "i",
|
||||
-- "<M-e>",
|
||||
-- "<Esc>I- ",
|
||||
-- { desc = "Markdown: Bullet Point", noremap = true, silent = true }
|
||||
-- )
|
||||
-- local wk = require("which-key")
|
||||
-- wk.add({
|
||||
-- { "<M-i>", mode = "i", desc = "Markdown Italics" },
|
||||
-- { "<M-b>", mode = "i", desc = "Markdown Bold" },
|
||||
-- })
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue