raku.vim (4201B)
1 " Vim filetype plugin file 2 " Language: Raku 3 " Maintainer: vim-perl <vim-perl@googlegroups.com> (need to be subscribed to post) 4 " Homepage: https://github.com/Raku/vim-raku 5 " Bugs/requests: https://github.com/Raku/vim-raku/issues 6 " Last Change: 2021 Apr 16 7 " 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') 8 " Contributors: Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> 9 " 10 " Based on ftplugin/perl.vim by Dan Sharp <dwsharp at hotmail dot com> 11 12 if exists("b:did_ftplugin") | finish | endif 13 let b:did_ftplugin = 1 14 15 " Make sure the continuation lines below do not cause problems in 16 " compatibility mode. 17 let s:save_cpo = &cpo 18 set cpo-=C 19 20 setlocal formatoptions-=t 21 setlocal formatoptions+=crqol 22 setlocal keywordprg=p6doc 23 24 setlocal comments=:#\|,:#=,:# 25 setlocal commentstring=#\ %s 26 27 " Provided by Ned Konz <ned at bike-nomad dot com> 28 "--------------------------------------------- 29 setlocal include=\\<\\(use\\\|require\\)\\> 30 setlocal includeexpr=substitute(v:fname,'::','/','g') 31 setlocal suffixesadd=.rakumod,.rakudoc,.pm6,.pm 32 setlocal define=[^A-Za-z_] 33 34 " The following line changes a global variable but is necessary to make 35 " gf and similar commands work. Thanks to Andrew Pimlott for pointing out 36 " the problem. If this causes a problem for you, add an 37 " after/ftplugin/raku.vim file that contains 38 " set isfname-=: 39 set isfname+=: 40 setlocal iskeyword=@,48-57,_,192-255,- 41 42 " Raku exposes its CompUnits through $*REPO, but mapping module names to 43 " compunit paths is nontrivial. Probably it's more convenient to rely on 44 " people using zef, which has a handy store of sources for modules it has 45 " installed. 46 func s:compareReverseFtime(a, b) 47 let atime = getftime(a:a) 48 let btime = getftime(a:b) 49 return atime > btime ? -1 : atime == btime ? 0 : 1 50 endfunc 51 52 let &l:path = "lib,." 53 if exists('$RAKULIB') 54 let &l:path = &l:path . "," . $RAKULIB 55 endif 56 let &l:path = &l:path . "," . join( 57 \ sort(glob("~/.zef/store/*/*/lib", 0, 1), "s:compareReverseFtime"), 58 \ ',') 59 60 " Convert ascii-based ops into their single-character unicode equivalent 61 if get(g:, 'raku_unicode_abbrevs', 0) 62 iabbrev <buffer> !(<) ⊄ 63 iabbrev <buffer> !(<=) ⊈ 64 iabbrev <buffer> !(>) ⊅ 65 iabbrev <buffer> !(>=) ⊉ 66 iabbrev <buffer> !(cont) ∌ 67 iabbrev <buffer> !(elem) ∉ 68 iabbrev <buffer> != ≠ 69 iabbrev <buffer> (&) ∩ 70 iabbrev <buffer> (+) ⊎ 71 iabbrev <buffer> (-) ∖ 72 iabbrev <buffer> (.) ⊍ 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> (atomic) ⚛ 82 iabbrev <buffer> (cont) ∋ 83 iabbrev <buffer> (elem) ∈ 84 iabbrev <buffer> * × 85 iabbrev <buffer> **0 ⁰ 86 iabbrev <buffer> **1 ¹ 87 iabbrev <buffer> **2 ² 88 iabbrev <buffer> **3 ³ 89 iabbrev <buffer> **4 ⁴ 90 iabbrev <buffer> **5 ⁵ 91 iabbrev <buffer> **6 ⁶ 92 iabbrev <buffer> **7 ⁷ 93 iabbrev <buffer> **8 ⁸ 94 iabbrev <buffer> **9 ⁹ 95 iabbrev <buffer> ... … 96 iabbrev <buffer> / ÷ 97 iabbrev <buffer> << « 98 iabbrev <buffer> <<[=]<< «=« 99 iabbrev <buffer> <<[=]>> «=» 100 iabbrev <buffer> <= ≤ 101 iabbrev <buffer> =~= ≅ 102 iabbrev <buffer> >= ≥ 103 iabbrev <buffer> >> » 104 iabbrev <buffer> >>[=]<< »=« 105 iabbrev <buffer> >>[=]>> »=» 106 iabbrev <buffer> Inf ∞ 107 iabbrev <buffer> atomic-add-fetch ⚛+= 108 iabbrev <buffer> atomic-assign ⚛= 109 iabbrev <buffer> atomic-fetch ⚛ 110 iabbrev <buffer> atomic-dec-fetch --⚛ 111 iabbrev <buffer> atomic-fetch-dec ⚛-- 112 iabbrev <buffer> atomic-fetch-inc ⚛++ 113 iabbrev <buffer> atomic-inc-fetch ++⚛ 114 iabbrev <buffer> atomic-sub-fetch ⚛−= 115 iabbrev <buffer> e 𝑒 116 iabbrev <buffer> o ∘ 117 iabbrev <buffer> pi π 118 iabbrev <buffer> set() ∅ 119 iabbrev <buffer> tau τ 120 endif 121 122 " Undo the stuff we changed. 123 let b:undo_ftplugin = "setlocal fo< com< cms< inc< inex< def< isf< isk< kp< path<" . 124 \ " | unlet! b:browsefilter" 125 126 " Restore the saved compatibility options. 127 let &cpo = s:save_cpo 128 unlet s:save_cpo