summary refs log tree commit diff
path: root/src/etc/vim/after/syntax/rust.vim
blob: c624e4c7befb56253091f04526c33a1ba2fc64d1 (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
if exists('g:no_rust_conceal') || !has('conceal') || &enc != 'utf-8'
	finish
endif

" For those who don't want to see `::`...
if exists('g:rust_conceal_mod_path')
	syn match rustNiceOperator "::" conceal cchar=ㆍ
endif

syn match rustLeftArrowHead contained "-" conceal cchar= 
syn match rustLeftArrowTail contained "<" conceal cchar=⟵
syn match rustNiceOperator "<-" contains=rustLeftArrowHead,rustLeftArrowTail

syn match rustRightArrowHead contained ">" conceal cchar= 
syn match rustRightArrowTail contained "-" conceal cchar=⟶
syn match rustNiceOperator "->" contains=rustRightArrowHead,rustRightArrowTail

syn match rustLeftRightArrowHead contained ">" conceal cchar= 
syn match rustLeftRightArrowTail contained "<-" conceal cchar=⟷
syn match rustNiceOperator "<->" contains=rustLeftRightArrowHead,rustLeftRightArrowTail

syn match rustFatRightArrowHead contained ">" conceal cchar= 
syn match rustFatRightArrowTail contained "=" conceal cchar=⟹
syn match rustNiceOperator "=>" contains=rustFatRightArrowHead,rustFatRightArrowTail

syn match rustNiceOperator /\<\@!_\(_*\>\)\@=/ conceal cchar=′

" For those who don't want to see `pub`...
if exists('g:rust_conceal_pub')
    syn match rustPublicSigil contained "pu" conceal cchar=*
    syn match rustPublicRest contained "b" conceal cchar= 
    syn match rustNiceOperator "pub " contains=rustPublicSigil,rustPublicRest
endif

hi link rustNiceOperator Operator

if !exists('g:rust_conceal_mod_path')
    hi! link Conceal Operator
endif

setlocal conceallevel=2