annotate runtime/ftplugin/vim.vim @ 33951:45a50fd59a73 v9.0.2170

patch 9.0.2170: Vim9: no support for const/final class/objects vars Commit: https://github.com/vim/vim/commit/e5437c542709b77ade084f96e60d84d4e847e6d3 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Sat Dec 16 14:11:19 2023 +0100 patch 9.0.2170: Vim9: no support for const/final class/objects vars Problem: Vim9: no support for const/final class/objects vars Solution: Support final and const object and class variables closes: #13655 Signed-off-by: Yegappan Lakshmanan <yegappan@yahoo.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Sat, 16 Dec 2023 14:15:05 +0100
parents 2d44cd7117fb
children 60e1e94a1b0e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 " Vim filetype plugin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: Vim
32770
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 32004
diff changeset
3 " Maintainer: The Vim Project <https://github.com/vim/vim>
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 32004
diff changeset
4 " Last Change: 2023 Aug 10
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 32004
diff changeset
5 " Former Maintainer: Bram Moolenaar <Bram@vim.org>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 " Only do this when not done yet for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 " Don't load another plugin for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
15 let s:cpo_save = &cpo
20552
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
16 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17
14298
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
18 if !exists('*VimFtpluginUndo')
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
19 func VimFtpluginUndo()
29403
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
20 setl fo< isk< com< tw< commentstring< include< define<
14519
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
21 if exists('b:did_add_maps')
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
22 silent! nunmap <buffer> [[
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
23 silent! vunmap <buffer> [[
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
24 silent! nunmap <buffer> ]]
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
25 silent! vunmap <buffer> ]]
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
26 silent! nunmap <buffer> []
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
27 silent! vunmap <buffer> []
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
28 silent! nunmap <buffer> ][
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
29 silent! vunmap <buffer> ][
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
30 silent! nunmap <buffer> ]"
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
31 silent! vunmap <buffer> ]"
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
32 silent! nunmap <buffer> ["
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
33 silent! vunmap <buffer> ["
14298
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
34 endif
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
35 unlet! b:match_ignorecase b:match_words b:match_skip b:did_add_maps
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
36 endfunc
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
37 endif
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
38
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
39 let b:undo_ftplugin = "call VimFtpluginUndo()"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " Set 'formatoptions' to break comment lines but not other lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 " and insert the comment leader when hitting <CR> or using "o".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 setlocal fo-=t fo+=croql
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
45 " To allow tag lookup via CTRL-] for autoload functions, '#' must be a
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
46 " keyword character. E.g., for netrw#Nread().
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
47 setlocal isk+=#
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
48
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 6213
diff changeset
49 " Use :help to lookup the keyword under the cursor with K.
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 6213
diff changeset
50 setlocal keywordprg=:help
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 6213
diff changeset
51
30202
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
52 " Comments starts with # in Vim9 script. We have to guess which one to use.
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
53 if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>'
23666
96206643bd9f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
54 setlocal commentstring=#%s
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
55 else
23666
96206643bd9f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
56 setlocal commentstring=\"%s
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
57 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
58
30202
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
59 " Set 'comments' to format dashed lists in comments, both in Vim9 and legacy
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
60 " script.
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
61 setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#,sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
62
29403
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
63 " set 'include' to recognize import commands
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
64 setlocal include=\\v^\\s*import\\s*(autoload)?
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
65
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
66 " set 'define' to recognize export commands
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
67 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 " Format comments to be up to 78 characters long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 if &tw == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 setlocal tw=78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
74 if !exists("no_plugin_maps") && !exists("no_vim_maps")
14298
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
75 let b:did_add_maps = 1
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
76
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
77 " Move around functions.
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
78 nnoremap <silent><buffer> [[ m':call search('^\s*\(fu\%[nction]\\|\(export\s\+\)\?def\)\>', "bW")<CR>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
79 vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|\(export\s\+\)\?def\)\>', "bW")<CR>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
80 nnoremap <silent><buffer> ]] m':call search('^\s*\(fu\%[nction]\\|\(export\s\+\)\?def\)\>', "W")<CR>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
81 vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|\(export\s\+\)\?def\)\>', "W")<CR>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
82 nnoremap <silent><buffer> [] m':call search('^\s*end\(f\%[unction]\\|\(export\s\+\)\?def\)\>', "bW")<CR>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
83 vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|\(export\s\+\)\?def\)\>', "bW")<CR>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
84 nnoremap <silent><buffer> ][ m':call search('^\s*end\(f\%[unction]\\|\(export\s\+\)\?def\)\>', "W")<CR>
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
85 vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|\(export\s\+\)\?def\)\>', "W")<CR>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
87 " Move around comments
33638
2d44cd7117fb runtime(vim): Update ftplugin - comment motions (#13412)
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
88 nnoremap <silent><buffer> ]" :call search('\%(^\s*".*\n\)\@<!\%(^\s*"\)', "W")<CR>
2d44cd7117fb runtime(vim): Update ftplugin - comment motions (#13412)
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
89 vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\@<!\%(^\s*"\)', "W")<CR>
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
90 nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
91 vnoremap <silent><buffer> [" :<C-U>exe "normal! gv"<Bar>call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
92 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 " Let the matchit plugin know what items can be matched.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 if exists("loaded_matchit")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 let b:match_ignorecase = 0
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
97 " "func" can also be used as a type:
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
98 " var Ref: func
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
99 " or to list functions:
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
100 " func name
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
101 " require a parenthesis following, then there can be an "endfunc".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 let b:match_words =
32004
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
103 \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+\s*(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
104 \ '\<\%(wh\%[ile]\|for\)\>:\%(\%(^\||\)\s*\)\@<=\<brea\%[k]\>:\%(\%(^\||\)\s*\)\@<=\<con\%[tinue]\>:\%(\%(^\||\)\s*\)\@<=\<end\%(w\%[hile]\|fo\%[r]\)\>,' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
105 \ '\<if\>:\%(\%(^\||\)\s*\)\@<=\<el\%[seif]\>:\%(\%(^\||\)\s*\)\@<=\<en\%[dif]\>,' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
106 \ '{:},' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
107 \ '\<try\>:\%(\%(^\||\)\s*\)\@<=\<cat\%[ch]\>:\%(\%(^\||\)\s*\)\@<=\<fina\%[lly]\>:\%(\%(^\||\)\s*\)\@<=\<endt\%[ry]\>,' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
108 \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
109 \ '\<class\>:\<endclass\>,' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
110 \ '\<inte\%[rface]\>:\<endinterface\>,' ..
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
111 \ '\<enu\%[m]\>:\<endenum\>,'
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
112
6213
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
113 " Ignore syntax region commands and settings, any 'en*' would clobber
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
114 " if-endif.
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
115 " - set spl=de,en
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
116 " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ …
32004
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
117 " Also ignore here-doc and dictionary keys (vimVar).
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
118 let b:match_skip = 'synIDattr(synID(line("."), col("."), 1), "name")
a9b5ffbc0428 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 31383
diff changeset
119 \ =~? "comment\\|string\\|vimSynReg\\|vimSet\\|vimLetHereDoc\\|vimVar"'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
122 let &cpo = s:cpo_save
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
123 unlet s:cpo_save
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
124
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
125 " removed this, because 'cpoptions' is a global option.
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
126 " setlocal cpo+=M " makes \%( match \)