20 lines
683 B
Lua
20 lines
683 B
Lua
local filename = vim.fn.shellescape(vim.api.nvim_buf_get_name(0))
|
|
|
|
-- Indentation & Layout
|
|
vim.opt_local.colorcolumn = ""
|
|
vim.opt_local.wrap = true
|
|
vim.opt_local.textwidth = 80
|
|
vim.opt_local.tabstop = 2
|
|
vim.opt_local.shiftwidth = 2
|
|
vim.opt_local.softtabstop = 2
|
|
|
|
-- Formatting Behavior: wrap text, keep comment/quote headers, parse lists
|
|
vim.opt_local.formatoptions:append({ "t", "q", "n", "j" })
|
|
|
|
-- gq Formatter: Prettier handles links/parentheses cleanly; par as fallback
|
|
if vim.fn.executable("prettier") == 1 then
|
|
vim.bo.formatprg = "prettier --parser markdown --stdin-filepath " .. filename
|
|
elseif vim.fn.executable("par") == 1 then
|
|
vim.bo.formatprg = "par -w80req"
|
|
end
|