raku.vim 4.0 KB

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