Added formatting for markdown, to wrap lines when buffer is saved

This commit is contained in:
2023-09-29 12:14:36 -04:00
parent 4b37f8afcb
commit 8d68b1033a
2 changed files with 18 additions and 1 deletions

View File

@@ -14,3 +14,13 @@ vim.api.nvim_exec([[
augroup END
]], false)
-- Wrap markdown lines when a buffer is written.
vim.api.nvim_create_autocmd(
"BufWritePre",
{
pattern = { "*.md", "*.markdown" },
command = ":normal ggVGgq",
group = vim.api.nvim_create_augroup("MyMarkdownLineWrapper", { clear = true })
}
)

View File

@@ -5,7 +5,14 @@ return {
require("formatter").setup({
filetype = {
markdown = {
require("formatter.filetypes.markdown").prettier
exe = "prettier",
args = {
"--stdin-filepath",
util.escape_path(util.get_current_buffer_file_path()),
"--line-width",
"100"
},
try_node_modules = true,
},
["*"] = {
-- formatter for any / all file types.