Reputation: 1492
Sorry if this has already been asked, but I didn't quite find what I was looking for.
Is there a way to do syntax highlighting for the entire hyperlink in .txt files for Vim?
This is what I have so far
hi Hyperlink term=standout,bold ctermfg=Cyan
let m = matchadd("Hyperlink", "http://")
let m = matchadd("Hyperlink", "https://")
Upvotes: 0
Views: 185
Reputation: 94397
See this amazing URL regexp in vim-highlighturl pligin.
I use a bit simpler regexp:
syntax match Hyperlink `\v<(((https?|ftp|gopher|telnet)://|(mailto|file|news|about|ed2k|irc|sip|magnet):)[^' \t<>"]+|(www|web|w3)[a-z0-9_-]*\.[a-z0-9._-]+\.[^' \t<>"]+)[a-z0-9/]`
Upvotes: 1