summaryrefslogtreecommitdiff
path: root/syntax/gmi.vim
blob: cf0dccdd761a0ea4c9d6a6e95eb27ff26d4b5152 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
" Vim syntax file
" " Language: gemini
" " Maintainer: sloum < sloum AT rawtext.club >
" " Latest Revision: 02 February 2020

"
" 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

" Handle monospaced blocks
syn region gmiMono start="```" end="```"

" Handle between one and three heading levels
syn match gmiHeader /^#\{1,3}.*$/

" Start a link line
syn match gmiLinkStart /^=>/ nextgroup=gmiLinkUrl skipwhite

" An extremely naive way of handling the URL portion of the link line
" TODO think about improving this
syn match gmiLinkUrl /\S\+/ contained nextgroup=gmiLinkTitle skipwhite

syn match gmiLinkTitle /.*$/ contained

" Handle list items
syn match gmiListItem /^\*.*$/

let b:current_syntax = "gmi"

hi def link gmiMono Special
hi def link gmiHeader Constant
hi def link gmiLinkStart Todo
hi def link gmiLinkUrl Underlined
hi def link gmiLinkTitle String
hi def link gmiListItem Identifier