I really like how vim paragraph auto format works for markdown. The one place where it falls flat on its face is when editing/formatting code and log output that I want to put into the markdown (maybe this says something questionable about the content of my blogs...) as code blocks.
I am hoping to configure this in such a way that vim treats regular text as comment and actual code blocks as sacred and not to be messed with. This would be consistent with its usual behavior I configure (formatoptions=a1njwbtcroql
) But I haven't found out how to do this. Could it be possible with a custom markdown syntax file? The one it comes with seems to highlight code blocks in green, which i appreciate since it lets me see that i've got it correct without having to keep an eye on the rendered output all the time.
For now I use this au filetype markdown setlocal nosmartindent | setlocal formatoptions-=a
to preserve sanity, but this forces me to manually format the paragraphs, which I'd rather avoid.