Ft_raku
Nvim :help
pages, generated
from source
using the tree-sitter-vimdoc parser.
Vim-raku provides syntax highlighting, indentation, and other support for
editing Raku programs.
1. Using Unicode in your Raku files raku-unicode
1. Using Unicode in your Raku files
Defining new operators using Unicode symbols is a good way to make your
Raku program easy to read. See:
https://perl6advent.wordpress.com/2012/12/18/day-18-formulas-resistance-is-futile/
While Raku does define ASCII alternatives for some common operators (see
https://docs.raku.org/language/unicode_ascii), using the full range of
Unicode operators is highly desirable. Your operating system provides input
facilities, but using the features built in to Vim may be preferable.
The natural way to produce these symbols in Vim is to use digraph shortcuts
(:help digraphs-use). Many of them are defined; type
:digraphs
to get
the list. A convenient way to read the list of digraphs is to save them in a
file. From the shell:vim +'redir >/tmp/vim-digraphs-listing.txt' +digraphs +'redir END' +qSome of them are available with standard Vim digraphs:
<< ยซ /0 โ
!< โฎ
>> ยป Ob โ !> โฏ
., โฆ 00 โ (C โ
(U โฉ -: รท )C โ
)U โช (_ โ >= โฅ
?= โ
)_ โ =< โค
(- โ ?= โ
!= โ
-) โ ?- โ
The Greek alphabet is available with '' followed by a similar Latin symbol:
p ฯt ฯX ร
Numbers, subscripts and superscripts are available with 's' and 'S':
0s โ 0S โฐ
1s โ 1S ยน
2s โ 9S โน
But some don't come defined by default. Those are digraph definitions you can
add in your ~/.vimrc file.
exec 'digraph \\ ' .. char2nr('โ') exec 'digraph \< ' .. char2nr('โผ') exec 'digraph \> ' .. char2nr('โฝ') exec 'digraph (L ' .. char2nr('โ') exec 'digraph )L ' .. char2nr('โ') exec 'digraph (/ ' .. char2nr('โ') exec 'digraph )/ ' .. char2nr('โ ') exec 'digraph )/ ' .. char2nr('โ ') exec 'digraph U+ ' .. char2nr('โ') exec 'digraph 0- ' .. char2nr('โ') " Euler's constant exec 'digraph ne ' .. char2nr('๐') " Raku's atomic operations marker exec 'digraph @@ ' .. char2nr('โ')Alternatively, you can write Insert mode abbreviations that convert ASCII- based operators into their single-character Unicode equivalent.
iabbrev <buffer> !(<) โ iabbrev <buffer> !(<=) โ iabbrev <buffer> !(>) โ iabbrev <buffer> !(>=) โ iabbrev <buffer> !(cont) โ iabbrev <buffer> !(elem) โ iabbrev <buffer> != โ iabbrev <buffer> (&) โฉ iabbrev <buffer> (+) โ iabbrev <buffer> (-) โ iabbrev <buffer> (.) โ iabbrev <buffer> (<) โ iabbrev <buffer> (<+) โผ iabbrev <buffer> (<=) โ iabbrev <buffer> (>) โ iabbrev <buffer> (>+) โฝ iabbrev <buffer> (>=) โ iabbrev <buffer> (\|) โช iabbrev <buffer> (^) โ iabbrev <buffer> (atomic) โ iabbrev <buffer> (cont) โ iabbrev <buffer> (elem) โ iabbrev <buffer> * ร iabbrev <buffer> **0 โฐ iabbrev <buffer> **1 ยน iabbrev <buffer> **2 ยฒ iabbrev <buffer> **3 ยณ iabbrev <buffer> **4 โด iabbrev <buffer> **5 โต iabbrev <buffer> **6 โถ iabbrev <buffer> **7 โท iabbrev <buffer> **8 โธ iabbrev <buffer> **9 โน iabbrev <buffer> ... โฆ iabbrev <buffer> / รท iabbrev <buffer> << ยซ iabbrev <buffer> <<[=]<< ยซ=ยซ iabbrev <buffer> <<[=]>> ยซ=ยป iabbrev <buffer> <= โค iabbrev <buffer> =~= โ iabbrev <buffer> >= โฅ iabbrev <buffer> >> ยป iabbrev <buffer> >>[=]<< ยป=ยซ iabbrev <buffer> >>[=]>> ยป=ยป iabbrev <buffer> Inf โ iabbrev <buffer> atomic-add-fetch โ+= iabbrev <buffer> atomic-assign โ= iabbrev <buffer> atomic-fetch โ iabbrev <buffer> atomic-dec-fetch --โ iabbrev <buffer> atomic-fetch-dec โ-- iabbrev <buffer> atomic-fetch-inc โ++ iabbrev <buffer> atomic-inc-fetch ++โ iabbrev <buffer> atomic-sub-fetch โโ= iabbrev <buffer> e ๐ iabbrev <buffer> o โ iabbrev <buffer> pi ฯ iabbrev <buffer> set() โ iabbrev <buffer> tau ฯ