nvim: Simplify prose filetype grouping

Simply have a markdown-like group and a org-like group for the plugins
that only target those specific prose modes.
This commit is contained in:
Marty Oehme 2024-09-15 22:09:58 +02:00
parent 65d5ac12ef
commit 03f18bea3a
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -1,18 +1,27 @@
local md_like = {
"markdown",
"pandoc",
"quarto",
"vimwiki",
}
local org_like = {
"norg",
"org",
}
local prose_ft = { local prose_ft = {
unpack(md_like),
unpack(org_like),
"asciidoc", "asciidoc",
"bib", "bib",
"context", "context",
"gitcommit", "gitcommit",
"latex", "latex",
"mail", "mail",
"markdown",
"pandoc",
"quarto",
"rst", "rst",
"tex", "tex",
"text", "text",
"typst", "typst",
"vimwiki", "rmd",
} }
local prose_plugs = { local prose_plugs = {
@ -29,7 +38,7 @@ local prose_plugs = {
"andrewferrier/wrapping.nvim", "andrewferrier/wrapping.nvim",
opts = { opts = {
create_keymaps = false, create_keymaps = false,
notify_on_switch = true, notify_on_switch = false,
-- softener = { quarto = true, markdown = true, text = true, asciidoc = true }, -- softener = { quarto = true, markdown = true, text = true, asciidoc = true },
auto_set_mode_filetype_allowlist = prose_ft, auto_set_mode_filetype_allowlist = prose_ft,
}, },
@ -59,7 +68,7 @@ local prose_plugs = {
"MeanderingProgrammer/render-markdown.nvim", "MeanderingProgrammer/render-markdown.nvim",
main = "render-markdown", main = "render-markdown",
opts = { opts = {
file_types = { "markdown", "quarto", "pandoc", "vimwiki", "norg", "rmd", "org" }, file_types = { unpack(md_like) },
code = { code = {
sign = false, sign = false,
width = "block", width = "block",
@ -68,7 +77,7 @@ local prose_plugs = {
}, },
name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim name = "render-markdown", -- Only needed if you have another plugin named markdown.nvim
dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons dependencies = { "nvim-treesitter/nvim-treesitter", "nvim-tree/nvim-web-devicons" }, -- if you prefer nvim-web-devicons
ft = prose_ft, ft = md_like,
cmd = "RenderMarkdown", cmd = "RenderMarkdown",
keys = { keys = {
{ {
@ -88,6 +97,7 @@ local prose_plugs = {
event = { "VeryLazy" }, event = { "VeryLazy" },
cond = vim.fn.executable("deno") == 1, cond = vim.fn.executable("deno") == 1,
build = "deno task --quiet build:fast", build = "deno task --quiet build:fast",
ft = md_like,
config = function() config = function()
require("peek").setup() require("peek").setup()
vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {}) vim.api.nvim_create_user_command("PeekOpen", require("peek").open, {})
@ -96,11 +106,12 @@ local prose_plugs = {
}, },
{ {
"iamcco/markdown-preview.nvim", "iamcco/markdown-preview.nvim",
event = { "VeryLazy" },
cond = vim.fn.executable("deno") == 0, cond = vim.fn.executable("deno") == 0,
build = function() build = function()
vim.fn["mkdp#util#install"]() vim.fn["mkdp#util#install"]()
end, end,
ft = prose_ft, ft = md_like,
}, },
-- easy copy paste of images into markup files -- easy copy paste of images into markup files
@ -187,7 +198,7 @@ local prose_plugs = {
}, },
-- syntax highlighting for markdown criticmarkup (comments, additions, ...) -- syntax highlighting for markdown criticmarkup (comments, additions, ...)
{ "vim-pandoc/vim-criticmarkup", ft = prose_ft }, { "vim-pandoc/vim-criticmarkup", ft = md_like },
-- create mindmaps from your markdown -- create mindmaps from your markdown
{ {