From 1920eb19f0efd0477c171b4eeda6b979fdefbe18 Mon Sep 17 00:00:00 2001 From: NerdyPepper Date: Tue, 13 Feb 2018 17:19:15 +0530 Subject: Add ligature plugins, installation instructions --- ligature_plugins/README.md | 33 +++++++++++++++++++++++++++++++++ ligature_plugins/haskell.vim | 2 +- ligature_plugins/python.vim | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 ligature_plugins/README.md create mode 100644 ligature_plugins/python.vim diff --git a/ligature_plugins/README.md b/ligature_plugins/README.md new file mode 100644 index 0000000..a17c67b --- /dev/null +++ b/ligature_plugins/README.md @@ -0,0 +1,33 @@ +# Ligatures and Unicode substitution + +These features are supported *in vim only*. + +### Installation + +Symlink the required vim plugins to + + - `~/.vim/after/syntax/` (vim) + - `~/.config/nvim/after/syntax/` (neovim) + + ```shell + #vim + cd ~/scientifica/ligature_plugins/ + for i in `ls *.vim`; do + ln -sf ~/scientifica/ligature_plugins/"$i" ~/.vim/after/syntax/"$i" + done + + #nvim + cd ~/scientifica/ligature_plugins/ + for i in `ls *.vim`; do + ln -sf ~/scientifica/ligature_plugins/"$i" ~/.config/nvim/after/syntax/"$i" + done + ``` + +Haskell in vim with scientifica: +![haskell_ligs](https://0x0.st/sT8a.png) + +Credits go to [romeovs](https://github.com/romeovs/) for the haskell plugin. +Credits go to [ehamberg](https://github.com/ehamberg/vim-cute-python) for the python plugin. + +Both plugins have been modified (haskell.vim especially) to play well with scientifica. +If you need ligatures for other languages, just open an issue, with the language and the ligature sequence. diff --git a/ligature_plugins/haskell.vim b/ligature_plugins/haskell.vim index b556b0a..e582dc7 100644 --- a/ligature_plugins/haskell.vim +++ b/ligature_plugins/haskell.vim @@ -3,7 +3,7 @@ " set correct conceal -set conceallevel=1 +setlocal conceallevel=1 " lambda's syntax match hsLambda "\\" conceal cchar=λ diff --git a/ligature_plugins/python.vim b/ligature_plugins/python.vim new file mode 100644 index 0000000..3542ae3 --- /dev/null +++ b/ligature_plugins/python.vim @@ -0,0 +1,37 @@ +" This is a fork of vim-cute-python +" with a few character replacements to +" play well with scientifica + +" 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 match pythonOperator "\" + +syntax match pyNiceOperator "\" conceal cchar=∈ +syntax match pyNiceOperator "\" conceal cchar=∨ +syntax match pyNiceOperator "\" conceal cchar=∧ +" include the space after “not” – if present – so that “not a” becomes “¬a”. +" also, don't hide “not” behind ‘¬’ if it is after “is ”. +syntax match pyNiceOperator "<=" conceal cchar=≤ +syntax match pyNiceOperator ">=" conceal cchar=≥ +" only conceal “==” if alone, to avoid concealing SCM conflict markers +syntax match pyNiceOperator "=\@" conceal cchar=√ +syntax match pyNiceKeyword "\<\%(math\.\)\?pi\>" conceal cchar=π + +syntax keyword pyNiceStatement lambda conceal cchar=λ + +hi link pyNiceOperator Operator +hi link pyNiceStatement Statement +hi link pyNiceKeyword Keyword +hi! link Conceal Operator + +setlocal conceallevel=1 -- cgit v1.2.3