Skip to content

Commit 6ee463c

Browse files
committed
Add vim-raku.txt documentation file; document unicode
This content is mostly taken from Pull Request Raku#12, by @eiro, so all credit goes to them for that. I've done some minor tweaking of language and formatting.
1 parent 8aa22d6 commit 6ee463c

File tree

1 file changed

+126
-0
lines changed

1 file changed

+126
-0
lines changed

doc/vim-raku.txt

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
*vim-raku.txt* The Raku programming language filetype
2+
3+
*vim-raku*
4+
5+
Vim-raku provides syntax highlighting, indentation, and other support for
6+
editing Raku programs.
7+
8+
1. Using Unicode in your Raku files |raku-unicode|
9+
10+
==============================================================================
11+
1. Using Unicode in your Raku files *raku-unicode*
12+
13+
Defining new operators using Unicode symbols is a good way to make your
14+
Raku program easy to read. See:
15+
https://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/
16+
17+
While Raku does define ASCII alternatives for some common operators (see
18+
https://docs.raku.org/language/unicode_ascii), using the full range of
19+
Unicode operators is highly desirable. Your operating system provides input
20+
facilities, but using the features built in to Vim may be preferable.
21+
22+
The natural way to produce these symbols in Vim is to use digraph shortcuts
23+
(:help |digraphs-use|). Many of them are defined; type `:digraphs` to get
24+
the list. A convenient way to read the list of digraphs is to save them in a
25+
file. From the shell: >
26+
vim +'redir >/tmp/vim-digraphs-listing.txt' +digraphs +'redir END' +q
27+
28+
Some of them are available with standard Vim digraphs:
29+
<< « /0 ∅ !< ≮ ~
30+
>> » Ob ∘ !> ≯ ~
31+
., … 00 ∞ (C ⊂ ~
32+
(U ∩ -: ÷ )C ⊃ ~
33+
)U ∪ (_ ⊆ >= ≥ ~
34+
?= ≅ )_ ⊇ =< ≤ ~
35+
(- ∈ ?= ≅ != ≠ ~
36+
-) ∋ ?- ≃ ~
37+
38+
The Greek alphabet is available with '*' followed by a similar Latin symbol:
39+
*p π ~
40+
*t τ ~
41+
*X × ~
42+
43+
Numbers, subscripts and superscripts are available with 's' and 'S':
44+
0s ₀ 0S ⁰ ~
45+
1s ₁ 1S ¹ ~
46+
2s ₂ 9S ⁹ ~
47+
48+
But some don´t come defined by default. Those are digraph definitions you can
49+
add in your ~/.vimrc file. >
50+
exec 'digraph \\ '.char2nr('∖')
51+
exec 'digraph \< '.char2nr('≼')
52+
exec 'digraph \> '.char2nr('≽')
53+
exec 'digraph (L '.char2nr('⊈')
54+
exec 'digraph )L '.char2nr('⊉')
55+
exec 'digraph (/ '.char2nr('⊄')
56+
exec 'digraph )/ '.char2nr('⊅')
57+
exec 'digraph )/ '.char2nr('⊅')
58+
exec 'digraph U+ '.char2nr('⊎')
59+
exec 'digraph 0- '.char2nr('⊖')
60+
" Euler's constant
61+
exec 'digraph ne '.char2nr('𝑒')
62+
" Raku's atomic operations marker
63+
exec 'digraph @@ '.char2nr('⚛')
64+
65+
Alternatively, you can write Insert mode abbreviations that convert ASCII-
66+
based operators into their single-character Unicode equivalent. >
67+
iabbrev <buffer> !(<) ⊄
68+
iabbrev <buffer> !(<=) ⊈
69+
iabbrev <buffer> !(>) ⊅
70+
iabbrev <buffer> !(>=) ⊉
71+
iabbrev <buffer> !(cont) ∌
72+
iabbrev <buffer> !(elem) ∉
73+
iabbrev <buffer> != ≠
74+
iabbrev <buffer> (&) ∩
75+
iabbrev <buffer> (+) ⊎
76+
iabbrev <buffer> (-) ∖
77+
iabbrev <buffer> (.) ⊍
78+
iabbrev <buffer> (<) ⊂
79+
iabbrev <buffer> (<+) ≼
80+
iabbrev <buffer> (<=) ⊆
81+
iabbrev <buffer> (>) ⊃
82+
iabbrev <buffer> (>+) ≽
83+
iabbrev <buffer> (>=) ⊇
84+
iabbrev <buffer> (\|) ∪
85+
iabbrev <buffer> (^) ⊖
86+
iabbrev <buffer> (atomic) ⚛
87+
iabbrev <buffer> (cont) ∋
88+
iabbrev <buffer> (elem) ∈
89+
iabbrev <buffer> * ×
90+
iabbrev <buffer> **0 ⁰
91+
iabbrev <buffer> **1 ¹
92+
iabbrev <buffer> **2 ²
93+
iabbrev <buffer> **3 ³
94+
iabbrev <buffer> **4 ⁴
95+
iabbrev <buffer> **5 ⁵
96+
iabbrev <buffer> **6 ⁶
97+
iabbrev <buffer> **7 ⁷
98+
iabbrev <buffer> **8 ⁸
99+
iabbrev <buffer> **9 ⁹
100+
iabbrev <buffer> ... …
101+
iabbrev <buffer> / ÷
102+
iabbrev <buffer> << «
103+
iabbrev <buffer> <<[=]<< «=«
104+
iabbrev <buffer> <<[=]>> «=»
105+
iabbrev <buffer> <= ≤
106+
iabbrev <buffer> =~= ≅
107+
iabbrev <buffer> >= ≥
108+
iabbrev <buffer> >> »
109+
iabbrev <buffer> >>[=]<< »=«
110+
iabbrev <buffer> >>[=]>> »=»
111+
iabbrev <buffer> Inf ∞
112+
iabbrev <buffer> atomic-add-fetch ⚛+=
113+
iabbrev <buffer> atomic-assign ⚛=
114+
iabbrev <buffer> atomic-fetch ⚛
115+
iabbrev <buffer> atomic-dec-fetch --⚛
116+
iabbrev <buffer> atomic-fetch-dec ⚛--
117+
iabbrev <buffer> atomic-fetch-inc ⚛++
118+
iabbrev <buffer> atomic-inc-fetch ++⚛
119+
iabbrev <buffer> atomic-sub-fetch ⚛−=
120+
iabbrev <buffer> e 𝑒
121+
iabbrev <buffer> o ∘
122+
iabbrev <buffer> pi π
123+
iabbrev <buffer> set() ∅
124+
iabbrev <buffer> tau τ
125+
<
126+
vim:tw=78:ts=8:noet:ft=help:norl:

0 commit comments

Comments
 (0)