2023-12-24 21:42:24 +00:00
|
|
|
|
local markdown = vim.api.nvim_create_augroup("markdown", { clear = true })
|
2023-12-25 15:02:03 +00:00
|
|
|
|
local spelling = vim.api.nvim_create_augroup("spelling", { clear = true })
|
2023-12-25 09:11:44 +00:00
|
|
|
|
|
2023-12-24 20:48:21 +00:00
|
|
|
|
-- Recognize .md as pandoc
|
2023-12-25 13:29:10 +00:00
|
|
|
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|
|
|
|
pattern = { "*.md", },
|
2023-12-24 21:42:24 +00:00
|
|
|
|
group = markdown,
|
2023-12-25 13:29:10 +00:00
|
|
|
|
callback = function()
|
2023-12-24 20:48:21 +00:00
|
|
|
|
vim.o.filetype = 'pandoc'
|
2024-05-24 11:22:08 +00:00
|
|
|
|
vim.o.commentstring = '<!--%s-->'
|
2023-12-25 13:29:10 +00:00
|
|
|
|
require('luasnip').filetype_extend("pandoc", { "markdown" })
|
2023-12-24 20:48:21 +00:00
|
|
|
|
vim.o.spell = true
|
2023-12-25 15:09:06 +00:00
|
|
|
|
require('spelling').spell_keymap()
|
2023-12-24 20:48:21 +00:00
|
|
|
|
vim.o.spelllang = 'en'
|
2023-12-24 21:40:34 +00:00
|
|
|
|
vim.o.formatoptions = "qj"
|
|
|
|
|
-- email commands: my/msy to paste the html inside the clipboard
|
2024-07-23 16:28:12 +00:00
|
|
|
|
vim.keymap.set('', '<LocalLeader>msy', ':w !pandoc -f markdown+emoji -t html5 -s | wl-copy --type text/html<CR><CR>',
|
2024-03-03 09:32:24 +00:00
|
|
|
|
{ noremap = true, silent = true, desc = "[M]arkdown to [S]ingle page [Y]ank" })
|
2024-11-10 14:38:47 +00:00
|
|
|
|
vim.keymap.set('', '<LocalLeader>my',
|
|
|
|
|
':w !pandoc -f markdown+emoji --wrap=none -t html5 | wl-copy --type text/html<CR><CR>',
|
2024-03-03 09:32:24 +00:00
|
|
|
|
{ noremap = true, silent = true, desc = "[M]arkdown to HTML [Y]ank" })
|
2024-11-10 14:38:47 +00:00
|
|
|
|
vim.keymap.set('', '<LocalLeader>mp', '<Plug>MarkdownPreviewToggle',
|
|
|
|
|
{ noremap = true, silent = true, desc = "[M]arkdown [P]review" })
|
2023-12-24 20:48:21 +00:00
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- French markdown files
|
2023-12-25 13:29:10 +00:00
|
|
|
|
vim.api.nvim_create_autocmd({ "BufEnter", "BufWinEnter" }, {
|
|
|
|
|
pattern = { "*-fr.md", },
|
2023-12-24 21:42:24 +00:00
|
|
|
|
group = markdown,
|
2023-12-25 13:29:10 +00:00
|
|
|
|
callback = function()
|
2023-12-24 20:48:21 +00:00
|
|
|
|
vim.o.spelllang = 'fr'
|
|
|
|
|
end
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
-- Spell shortcuts
|
2023-12-25 13:29:10 +00:00
|
|
|
|
vim.api.nvim_create_autocmd({ "OptionSet" }, {
|
2023-12-24 20:48:21 +00:00
|
|
|
|
pattern = { "spell" },
|
2023-12-25 15:02:03 +00:00
|
|
|
|
group = spelling,
|
|
|
|
|
callback = require('spelling').spell_keymap
|
2023-12-24 20:48:21 +00:00
|
|
|
|
})
|
2023-12-25 11:17:23 +00:00
|
|
|
|
|
|
|
|
|
-- LaTeX configuration
|
|
|
|
|
local texgroup = vim.api.nvim_create_augroup("latex", { clear = true })
|
|
|
|
|
|
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
2023-12-25 15:09:06 +00:00
|
|
|
|
pattern = { "latex", "tex" },
|
2023-12-25 11:17:23 +00:00
|
|
|
|
group = texgroup,
|
|
|
|
|
callback = function()
|
|
|
|
|
-- vimtex configuration
|
|
|
|
|
vim.g.vimtex_view_method = 'zathura'
|
2024-01-03 14:32:02 +00:00
|
|
|
|
vim.g.vimtex_view_general_viewer = 'zathura'
|
2023-12-25 13:29:10 +00:00
|
|
|
|
vim.g.maplocalleader = ' '
|
2023-12-25 11:17:23 +00:00
|
|
|
|
-- Legacy shortcut from my vim-latexsuite days
|
2024-12-11 14:54:38 +00:00
|
|
|
|
-- FIX: doesn’t seem to work…
|
|
|
|
|
vim.keymap.set("n", "<Leader>ls", ":VimtexView<CR>",
|
2023-12-25 13:29:10 +00:00
|
|
|
|
{ noremap = true, silent = true, desc = 'View [L]atex Document' })
|
2023-12-25 11:17:23 +00:00
|
|
|
|
|
|
|
|
|
vim.o.foldmethod = 'expr'
|
2023-12-25 13:29:10 +00:00
|
|
|
|
vim.o.foldexpr = 'vimtex#fold#level(v:lnum)'
|
|
|
|
|
vim.o.foldtext = 'vimtex#fold#text()'
|
2023-12-25 11:17:23 +00:00
|
|
|
|
vim.o.spell = true
|
2023-12-25 15:09:06 +00:00
|
|
|
|
require('spelling').spell_keymap()
|
2023-12-25 11:17:23 +00:00
|
|
|
|
end,
|
|
|
|
|
})
|
2024-10-11 08:50:29 +00:00
|
|
|
|
|
|
|
|
|
-- Typst bindings
|
|
|
|
|
local typstgroup = vim.api.nvim_create_augroup("typst", { clear = true })
|
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
|
|
|
pattern = { "typst" },
|
|
|
|
|
group = typstgroup,
|
|
|
|
|
callback = function()
|
|
|
|
|
vim.keymap.set('', '<LocalLeader>mp', ':TypstWatch<CR>', { noremap = true, silent = true, desc = "[M]ake [P]review" })
|
|
|
|
|
require('spelling').spell_keymap()
|
|
|
|
|
end,
|
|
|
|
|
})
|
|
|
|
|
|
2024-11-10 14:03:48 +00:00
|
|
|
|
-- Jujutsu spellchecking
|
|
|
|
|
local jjgroup = vim.api.nvim_create_augroup("jujustu", { clear = true })
|
|
|
|
|
vim.api.nvim_create_autocmd("FileType", {
|
|
|
|
|
pattern = { "jj" },
|
|
|
|
|
group = jjgroup,
|
|
|
|
|
callback = function()
|
|
|
|
|
vim.o.spell = true
|
|
|
|
|
vim.o.spelllang = "en"
|
|
|
|
|
require('spelling').spell_keymap()
|
|
|
|
|
end,
|
|
|
|
|
})
|