Let's say I have this Markdown file:
[Lorem ipsum dolor sit ](http://vi.stackexchange.com/many-links-are-often-very)
Lookin' good. But the link isn't finished it, so I type -long
, and now Vim
breaks the line:
[Lorem ipsum dolor sit
](http://vi.stackexchange.com/many-links-are-often-very-long)
Because of my textwidth=80
setting... While breaking a link mid-tag is
technically valid markdown, it looks very unsightly IMHO; having nice looking
source files is sort of the point of markdown.
With gq the problem is often even worse:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.
Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec
[Lorem ipsum dolor sit](http://vi.stackexchange.com/many-links-are-often-very-very-long)
Becomes this:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus.
Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec [Lorem
ipsum dolor
sit](http://vi.stackexchange.com/many-links-are-often-very-very-long)
Is there any way I can tell Vim or the markdown syntax to not break links in this way?
- Maybe by treating the entire link (from
[
to)
) as a single word. - I have the same problem with
[this][type]
of markdown link.