💾 Archived View for tilde.club › ~filip › tech › config › gemtext.vim › gemtext.vim captured on 2023-03-20 at 18:39:30.

View Raw

More Information

⬅️ Previous capture (2022-07-16)

-=-=-=-=-=-=-

" Vim syntax file
"" Language: gemtext

" For version 5.x: Clear all syntax items
" For version 6.x: Quit when a syntax file was already loaded
if version < 600
	syntax clear
elseif exists("b:current_syntax")
	finish
endif

" Gemtext elements
"" Monospaced block
syn region gmiMono start=/^```/ end=/^```/
"" Header
syn match gmiHeaderSigil /^#\{1,3}/ nextgroup=gmiHeaderTitle skipwhite
syn match gmiHeaderTitle /.*/ contained skipwhite
"" Link
syn match gmiLinkSigil /^=>/ nextgroup=gmiLinkUrl skipwhite
syn match gmiLinkUrl /\S\+/ contained nextgroup=gmiLinkTitle skipwhite
syn match gmiLinkTitle /.*$/ contained
"" Quote
syn match gmiQuoteSigil /^>/ nextgroup=gmiQuoteText skipwhite
syn match gmiQuoteText /.*$/ contained
"" List item
syn match gmiListSigil /^\*/ nextgroup=gmiListItem skipwhite
syn match gmiListItem /.*$/ contained

" Gemtext highlights
"" Monospaced block
highlight gmiMonoHighlight ctermfg=cyan
"" Header
highlight gmiHeaderSigilHighlight ctermfg=darkblue
highlight gmiHeaderTitleHighlight ctermfg=darkcyan
"" Link
highlight gmiLinkSigilHighlight ctermfg=cyan
highlight gmiLinkUrlHighlight ctermfg=cyan cterm=underline
highlight gmiLinkTitleHighlight ctermfg=darkcyan
"" Quote
highlight gmiQuoteSigilHighlight ctermfg=cyan
highlight gmiQuoteTextHighlight ctermfg=lightgrey
"" List item
highlight gmiListSigilHighlight ctermfg=cyan
highlight gmiListItemHighlight ctermfg=lightgrey

" Turn on the gemtext syntax highlight
let b:current_syntax = "gemtext"
hi def link gmiMono gmiMonoHighlight
hi def link gmiHeaderSigil gmiHeaderSigilHighlight
hi def link gmiHeaderTitle gmiHeaderTitleHighlight
hi def link gmiLinkSigil gmiLinkSigilHighlight
hi def link gmiLinkUrl gmiLinkUrlHighlight
hi def link gmiLinkTitle gmiLinkTitleHighlight
hi def link gmiQuoteSigil gmiQuoteSigilHighlight
hi def link gmiQuoteText gmiQuoteTextHighlight
hi def link gmiListSigil gmiLinkSigilHighlight
hi def link gmiListItem gmiListItemHighlight