vim-polyglot/after/syntax/rust.vim

46 lines
1.4 KiB
VimL
Raw Normal View History

if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'rust') == -1
2018-07-08 09:16:28 -04:00
scriptencoding utf-8
if !get(g:, 'rust_conceal', 0) || !has('conceal') || &encoding !=# 'utf-8'
finish
2013-09-26 06:44:31 -04:00
endif
" For those who don't want to see `::`...
2018-07-08 09:16:28 -04:00
if get(g:, 'rust_conceal_mod_path', 0)
syn match rustNiceOperator "::" conceal cchar=
2013-09-26 06:44:31 -04:00
endif
syn match rustRightArrowHead contained ">" conceal cchar= 
syn match rustRightArrowTail contained "-" conceal cchar=
syn match rustNiceOperator "->" contains=rustRightArrowHead,rustRightArrowTail
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`...
2018-07-08 09:16:28 -04:00
if get(g:, 'rust_conceal_pub', 0)
2013-09-26 06:44:31 -04:00
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
2018-07-08 09:16:28 -04:00
if !get(g:, 'rust_conceal_mod_path', 0)
2013-09-26 06:44:31 -04:00
hi! link Conceal Operator
2016-06-17 14:47:16 -04:00
2018-07-08 09:16:28 -04:00
augroup rust.vim.after
autocmd!
" And keep it after a colorscheme change
autocmd ColorScheme <buffer> hi! link Conceal Operator
augroup END
2013-09-26 06:44:31 -04:00
endif
2018-07-08 09:16:28 -04:00
" vim: set et sw=4 sts=4 ts=8:
endif