diff options
-rw-r--r-- | ligature_plugins/README.md | 33 | ||||
-rw-r--r-- | ligature_plugins/haskell.vim | 2 | ||||
-rw-r--r-- | ligature_plugins/python.vim | 37 |
3 files changed, 71 insertions, 1 deletions
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 @@ | |||
1 | # Ligatures and Unicode substitution | ||
2 | |||
3 | These features are supported *in vim only*. | ||
4 | |||
5 | ### Installation | ||
6 | |||
7 | Symlink the required vim plugins to | ||
8 | |||
9 | - `~/.vim/after/syntax/` (vim) | ||
10 | - `~/.config/nvim/after/syntax/` (neovim) | ||
11 | |||
12 | ```shell | ||
13 | #vim | ||
14 | cd ~/scientifica/ligature_plugins/ | ||
15 | for i in `ls *.vim`; do | ||
16 | ln -sf ~/scientifica/ligature_plugins/"$i" ~/.vim/after/syntax/"$i" | ||
17 | done | ||
18 | |||
19 | #nvim | ||
20 | cd ~/scientifica/ligature_plugins/ | ||
21 | for i in `ls *.vim`; do | ||
22 | ln -sf ~/scientifica/ligature_plugins/"$i" ~/.config/nvim/after/syntax/"$i" | ||
23 | done | ||
24 | ``` | ||
25 | |||
26 | Haskell in vim with scientifica: | ||
27 | ![haskell_ligs](https://0x0.st/sT8a.png) | ||
28 | |||
29 | Credits go to [romeovs](https://github.com/romeovs/) for the haskell plugin. | ||
30 | Credits go to [ehamberg](https://github.com/ehamberg/vim-cute-python) for the python plugin. | ||
31 | |||
32 | Both plugins have been modified (haskell.vim especially) to play well with scientifica. | ||
33 | 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 @@ | |||
3 | 3 | ||
4 | 4 | ||
5 | " set correct conceal | 5 | " set correct conceal |
6 | set conceallevel=1 | 6 | setlocal conceallevel=1 |
7 | 7 | ||
8 | " lambda's | 8 | " lambda's |
9 | syntax match hsLambda "\\" conceal cchar=λ | 9 | 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 @@ | |||
1 | " This is a fork of vim-cute-python | ||
2 | " with a few character replacements to | ||
3 | " play well with scientifica | ||
4 | |||
5 | " we need the conceal feature (vim ≥ 7.3) | ||
6 | if !has('conceal') | ||
7 | finish | ||
8 | endif | ||
9 | |||
10 | " remove the keywords. we'll re-add them below | ||
11 | syntax clear pythonOperator | ||
12 | |||
13 | syntax match pythonOperator "\<is\>" | ||
14 | |||
15 | syntax match pyNiceOperator "\<in\>" conceal cchar=∈ | ||
16 | syntax match pyNiceOperator "\<or\>" conceal cchar=∨ | ||
17 | syntax match pyNiceOperator "\<and\>" conceal cchar=∧ | ||
18 | " include the space after “not” – if present – so that “not a” becomes “¬a”. | ||
19 | " also, don't hide “not” behind ‘¬’ if it is after “is ”. | ||
20 | syntax match pyNiceOperator "<=" conceal cchar=≤ | ||
21 | syntax match pyNiceOperator ">=" conceal cchar=≥ | ||
22 | " only conceal “==” if alone, to avoid concealing SCM conflict markers | ||
23 | syntax match pyNiceOperator "=\@<!===\@!" conceal cchar=≡ | ||
24 | syntax match pyNiceOperator "!=" conceal cchar=≠ | ||
25 | |||
26 | syntax keyword pyNiceOperator sum conceal cchar=∑ | ||
27 | syntax match pyNiceOperator "\<\%(math\.\)\?sqrt\>" conceal cchar=√ | ||
28 | syntax match pyNiceKeyword "\<\%(math\.\)\?pi\>" conceal cchar=π | ||
29 | |||
30 | syntax keyword pyNiceStatement lambda conceal cchar=λ | ||
31 | |||
32 | hi link pyNiceOperator Operator | ||
33 | hi link pyNiceStatement Statement | ||
34 | hi link pyNiceKeyword Keyword | ||
35 | hi! link Conceal Operator | ||
36 | |||
37 | setlocal conceallevel=1 | ||