Closed Jarmos-san closed 1 month ago
Take a look at the recipe for adding extra features to autoformatting.
Alright thanks for guiding me to the right place for help! For future reference and if anyone is interested in it, here's a snippet of the code I used:
format_on_save = function(bufnr)
local bufname = vim.api.nvim_buf_get_name(bufnr)
-- Disable file formatting on any temporary buffer contents
if bufname:match("/tmp/") then
return
else
return {
timeout_ms = 2500,
lsp_fallback = true,
}
end
end
Did you check existing requests?
Describe the feature
Disable formatting using
conform.nvim
on certain file patterns like/tmp/1234567.md
and so on.Provide background
In my configurations I have enabled
conform.nvim
to format ALL Markdown files. On certain file patterns like/tmp/123455.md
this is an undesired behaviour.These temporary files are used by tools like
gh
(GitHub CLI) to create temporary Markdown content using Neovim before they are shipped to the GitHub servers for final rendering on the Web UI. Sinceconform.nvim
will format the files according to the instructions I have laid out for it, such temporary Markdown files often get rendered undesirably on GitHub's web UI.I use
gh
extensively and having to fix the formatting of the Markdown content on the web UI is annoying and if possible I would like an option to disable it on the said temporary file patterns.What is the significance of this feature?
strongly desired
Additional details
No response