blob: 3d1179ed4ef18bd205fffe0266d2a03752c7e98d [file] [log] [blame]
Bram Moolenaar4d8f4762021-06-27 15:18:56 +02001*ft_raku.txt* The Raku programming language filetype
Bram Moolenaar11e3c5b2021-04-21 18:09:37 +02002
3 *vim-raku*
4
5Vim-raku provides syntax highlighting, indentation, and other support for
6editing Raku programs.
7
81. Using Unicode in your Raku files |raku-unicode|
9
10==============================================================================
111. Using Unicode in your Raku files *raku-unicode*
12
13Defining new operators using Unicode symbols is a good way to make your
14Raku program easy to read. See:
15https://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/
16
17While Raku does define ASCII alternatives for some common operators (see
18https://docs.raku.org/language/unicode_ascii), using the full range of
19Unicode operators is highly desirable. Your operating system provides input
20facilities, but using the features built in to Vim may be preferable.
21
22The 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
24the list. A convenient way to read the list of digraphs is to save them in a
25file. From the shell: >
26 vim +'redir >/tmp/vim-digraphs-listing.txt' +digraphs +'redir END' +q
27
28Some of them are available with standard Vim digraphs:
29 << « /0 ∅ !< ≮ ~
30 >> » Ob ∘ !> ≯ ~
31 ., … 00 ∞ (C ⊂ ~
32 (U ∩ -: ÷ )C ⊃ ~
33 )U ∪ (_ ⊆ >= ≥ ~
34 ?= ≅ )_ ⊇ =< ≤ ~
35 (- ∈ ?= ≅ != ≠ ~
36 -) ∋ ?- ≃ ~
37
38The Greek alphabet is available with '*' followed by a similar Latin symbol:
39 *p π ~
40 *t τ ~
41 *X × ~
42
43Numbers, subscripts and superscripts are available with 's' and 'S':
44 0s ₀ 0S ⁰ ~
45 1s ₁ 1S ¹ ~
46 2s ₂ 9S ⁹ ~
47
Bram Moolenaar2346a632021-06-13 19:02:49 +020048But some don't come defined by default. Those are digraph definitions you can
Bram Moolenaar11e3c5b2021-04-21 18:09:37 +020049add in your ~/.vimrc file. >
Bram Moolenaarc51cf032022-02-26 12:25:45 +000050 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('⊖')
Bram Moolenaar11e3c5b2021-04-21 18:09:37 +020060 " Euler's constant
Bram Moolenaarc51cf032022-02-26 12:25:45 +000061 exec 'digraph ne ' .. char2nr('𝑒')
Bram Moolenaar11e3c5b2021-04-21 18:09:37 +020062 " Raku's atomic operations marker
Bram Moolenaarc51cf032022-02-26 12:25:45 +000063 exec 'digraph @@ ' .. char2nr('⚛')
Bram Moolenaar11e3c5b2021-04-21 18:09:37 +020064
65Alternatively, you can write Insert mode abbreviations that convert ASCII-
66based 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: