Skip to content

Tweaks to the rust/vim conceal support #3081

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 2, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/etc/vim/after/syntax/rust.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
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=′

hi link rustNiceOperator Operator
hi! link Conceal Operator
setlocal conceallevel=2
15 changes: 1 addition & 14 deletions src/etc/vim/syntax/rust.vim
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,6 @@ syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo ke

syn keyword rustTodo TODO FIXME XXX NB

" For those who don't want to see `::`...
syn match rustModPathSep "::" conceal cchar=ㆍ

syn match rustArrowHead contained ">" conceal cchar= 
syn match rustArrowTail contained "-" conceal cchar=⟶
syn match rustArrowFull "->" contains=rustArrowHead,rustArrowTail

syn match rustFatArrowHead contained ">" conceal cchar= 
syn match rustFatArrowTail contained "=" conceal cchar=⟹
syn match rustFatArrowFull "=>" contains=rustFatArrowHead,rustFatArrowTail

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

hi def link rustHexNumber rustNumber
hi def link rustBinNumber rustNumber
hi def link rustIdentifierPrime rustIdentifier
Expand All @@ -136,7 +123,7 @@ hi def link rustMacro Macro
hi def link rustType Type
hi def link rustTodo Todo
hi def link rustAttribute PreProc
hi def link rustModPathSep Conceal

" Other Suggestions:
" hi rustAssert ctermfg=yellow
" hi rustMacro ctermfg=magenta
Expand Down