annotate runtime/ftplugin/raku.vim @ 26773:80e134cbee4b v8.2.3915

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