Skip to content

Instantly share code, notes, and snippets.

@andrusha
Created May 2, 2011 23:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save andrusha/952550 to your computer and use it in GitHub Desktop.
Save andrusha/952550 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=ℂ
hi link pyNiceOperator Operator
hi link pyNiceStatement Statement
hi! link Conceal Operator
set conceallevel=2
@daimoniac
Copy link

very nice!

missing "for", "return", and "def" operators.
http://www.modernemacs.com/post/prettify-mode/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment