Skip to content

Instantly share code, notes, and snippets.

@daimoniac
Forked from andrusha/python.vim
Last active March 23, 2018 09:17
Show Gist options
  • Save daimoniac/53059503a3a8eac2ef21a378a81a478b to your computer and use it in GitHub Desktop.
Save daimoniac/53059503a3a8eac2ef21a378a81a478b to your computer and use it in GitHub Desktop.
Pretty math symbols for python
" place it in ~/.vim/after/syntax/python.vim
" we need the conceal feature (vim ≥ 7.3)
if !has('conceal')
finish
endif
" remove the keywords. we'll re-add them below
syntax clear pythonOperator
syntax keyword pythonOperator is
syntax match pyNiceOperator "\<in\>" conceal cchar=∈
syntax match pyNiceOperator "\<or\>" conceal cchar=∨
syntax match pyNiceOperator "\<and\>" conceal cchar=∧
syntax match pyNiceOperator "\<not " conceal cchar=¬
syntax match pyNiceOperator "<=" conceal cchar=≤
syntax match pyNiceOperator ">=" conceal cchar=≥
syntax match pyNiceOperator "==" conceal cchar=≡
syntax match pyNiceOperator "!=" conceal cchar=≠
syntax match pyNiceOperator "\<not in\>" conceal cchar=∉
syntax keyword pyNiceStatement lambda conceal cchar=λ
syntax keyword pyNiceStatement int conceal cchar=ℤ
syntax keyword pyNiceStatement float conceal cchar=ℝ
syntax keyword pyNiceStatement complex conceal cchar=ℂ
syntax keyword pyNiceStatement True conceal cchar=⊤
syntax keyword pyNiceStatement False conceal cchar=⊥
syntax keyword pyNiceStatement for conceal cchar=∀
syntax keyword pyNiceStatement def conceal cchar=ƒ
syntax keyword pyNiceStatement return conceal cchar=↦
hi link pyNiceOperator Operator
hi link pyNiceStatement Statement
hi! link Conceal Operator
set conceallevel=2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment