after/syntax/rst.vim
¶
Don’t limit ourselves to plain ASCII encoding:
scriptencoding utf-8
Enforce vim script implementation to reduce ambiguities and improve robustness:
scriptversion 4
Bail early if conceal
isn’t supported:
if !has('conceal')
finish
endif
Show pretty bullets for unordered lists:
syntax match rstList "^[*-]\ze "hs=e conceal cchar=•
syntax match rstList "^\s\+[*-]\ze "hs=e conceal cchar=◦
Note
I only use *
and -
for list prefixes, so these won’t work for
everyone. However, including all the reST prefix options opens the door for
a lot of incorrect highlights without massively increasing the complexity.
Show pretty markers for ordered lists:
for s:n in range(1, 10)
execute printf('syntax match rstList "^%d\.\ze " conceal cchar=%s',
\ s:n, nr2char(9'351 + s:n))
endfor
for s:n in range(1, 12)
execute printf('syntax match rstList "^\s\+%d\.\ze "hs=e-1 ' ..
\ 'conceal cchar=%s',
\ s:n, nr2char(8'559 + s:n))
endfor