Skip to content
Browse files

Terminal UTF font, Added sexy vim UTF conceals for haskell.

  • Loading branch information...
1 parent f691d97 commit cf7ef0161dfaa24b36bfb34e65d94d9dcfcbc626 @raposalorx committed Jan 25, 2012
Showing with 111 additions and 2 deletions.
  1. +2 −2 .Xresources
  2. +109 −0 .vim/after/syntax/haskell.vim
View
4 .Xresources
@@ -23,8 +23,8 @@ Xft.hinting: false
!Xft.hintstyle: hintsfull
!Xft.dpi: 96
!Xft.rgba: rgba
-URxvt*font:xft:Inconsolata:size=9, xft:Kochi Gothic:antialias=false
-URxvt*boldFont:xft:Inconsolata:bold:size=10
+URxvt*font:xft:DejaVuSansMono:size=8, xft:Kochi Gothic:antialias=false
+URxvt*boldFont:xft:DejaVuSansMono-Bold:bold:size=8
!URxvt*boldFont:xft:Monospace:pixelsize=8:antialias=true
urxvt.urgentOnBell: true
View
109 .vim/after/syntax/haskell.vim
@@ -0,0 +1,109 @@
+"=============================================================================
+" What Is This: Add some conceal operator for your haskell files
+" File: haskell.vim (conceal enhancement)
+" Author: Vincent Berthoux <twinside@gmail.com>
+" Last Change: 2011-09-07
+" Version: 1.3.2
+" Require:
+" set nocompatible
+" somewhere on your .vimrc
+"
+" Vim 7.3 or Vim compiled with conceal patch.
+" Use --with-features=big or huge in order to compile it in.
+"
+" Usage:
+" Drop this file in your
+" ~/.vim/after/syntax folder (Linux/MacOSX/BSD...)
+" ~/vimfiles/after/syntax folder (Windows)
+"
+" For this script to work, you have to set the encoding
+" to utf-8 :set enc=utf-8
+"
+" Additional:
+" * if you want to avoid the loading, add the following
+" line in your .vimrc :
+" let g:no_haskell_conceal = 1
+" Changelog:
+" - 1.3.1: putting undefined in extra conceal, not appearing on windows
+" - 1.3: adding new arrow characters used by GHC in Unicode extension.
+" - 1.2: Fixing conceal level to be local (thx Erlend Hamberg)
+" - 1.1: Better handling of non utf-8 systems, and avoid some
+" concealing operations on windows on some fonts
+"
+if exists('g:no_haskell_conceal') || !has('conceal') || &enc != 'utf-8'
+ finish
+endif
+
+" vim: set fenc=utf-8:
+syntax match hsNiceOperator "\\\ze[[:alpha:][:space:]_([]" conceal cchar=λ
+syntax match hsNiceOperator "<-" conceal cchar=←
+syntax match hsNiceOperator "->" conceal cchar=→
+syntax match hsNiceOperator "\<sum\>" conceal cchar=∑
+syntax match hsNiceOperator "\<product\>" conceal cchar=∏
+syntax match hsNiceOperator "\<sqrt\>" conceal cchar=√
+syntax match hsNiceOperator "\<pi\>" conceal cchar=π
+syntax match hsNiceOperator "\<all\>" conceal cchar=∀
+syntax match hsNiceOperator "\<any\>" conceal cchar=∃
+syntax match hsNiceOperator "==" conceal cchar=≡
+syntax match hsNiceOperator "&&" conceal cchar=⋏
+syntax match hsNiceOperator "||" conceal cchar=⋎
+syntax match hsNiceOperator "\/=" conceal cchar=≠
+
+syntax match hsNiceOperator "`\<union\>`" conceal cchar=∪
+syntax match hsNiceOperator "`\<intersect\>`" conceal cchar=∩
+syntax match hsNiceOperator "`\<elem\>`" conceal cchar=∈
+syntax match hsNiceOperator "\[0\.\.\]" conceal cchar=ℕ
+"syntax match hsNiceOperator ">>" conceal cchar=»
+
+let s:extraConceal = 1
+" Some windows font don't support some of the characters,
+" so if they are the main font, we don't load them :)
+if has("win32")
+ let s:incompleteFont = [ 'Consolas'
+ \ , 'Lucida Console'
+ \ , 'Courier New'
+ \ ]
+ let s:mainfont = substitute( &guifont, '^\([^:,]\+\).*', '\1', '')
+ for s:fontName in s:incompleteFont
+ if s:mainfont ==? s:fontName
+ let s:extraConceal = 0
+ break
+ endif
+ endfor
+endif
+
+if s:extraConceal
+" syntax match hsNiceOperator "\<undefined\>" conceal cchar=⊥
+
+ " Match greater than and lower than w/o messing with Kleisli composition
+ syntax match hsNiceOperator "<=\ze[^<]" conceal cchar=≲
+ syntax match hsNiceOperator ">=\ze[^>]" conceal cchar=≳
+
+" syntax match hsNiceOperator "=>" conceal cchar=⇒
+" syntax match hsNiceOperator "=\zs<<" conceal cchar=«
+
+ " Redfining to get proper '::' concealing
+ syntax match hs_DeclareFunction /^[a-z_(]\S*\(\s\|\n\)*::/me=e-2 nextgroup=hsNiceOperator contains=hs_FunctionName,hs_OpFunctionName
+ syntax match hsNiceOperator "\:\:" conceal cchar=∷
+
+ syntax match hsniceoperator "++" conceal cchar=⧺
+" syntax match hsNiceOperator "\<forall\>" conceal cchar=∀
+" syntax match hsNiceOperator "-<" conceal cchar=↢
+" syntax match hsNiceOperator ">-" conceal cchar=↣
+" syntax match hsNiceOperator "-<<" conceal cchar=⤛
+" syntax match hsNiceOperator ">>-" conceal cchar=⤜
+ " the star does not seem so good...
+ " syntax match hsNiceOperator "*" conceal cchar=★
+
+ " Only replace the dot, avoid taking spaces around.
+" syntax match hsNiceOperator /\s\.\s/ms=s+1,me=e-1 conceal cchar=∘
+" syntax match hsNiceOperator "\.\." conceal cchar=‥
+
+" syntax match hsQQEnd "|\]" contained conceal cchar=〛
+ " sy match hsQQEnd "|\]" contained conceal=〚
+endif
+
+hi link hsNiceOperator Operator
+hi! link Conceal Operator
+setlocal conceallevel=2
+

0 comments on commit cf7ef01

Please sign in to comment.
Something went wrong with that request. Please try again.