annotate runtime/ftplugin/vim.vim @ 31430:e5e95e8c78a7

Update runtime files Commit: https://github.com/vim/vim/commit/7db29e4b5c3a347d24ca5062ddaa5cf4c4d54b9c Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 11 15:53:04 2022 +0000 Update runtime files
author Bram Moolenaar <Bram@vim.org>
date Sun, 11 Dec 2022 17:00:05 +0100
parents 15c80d8bc515
children a9b5ffbc0428
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3 " Maintainer: Bram Moolenaar <Bram@vim.org>
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30547
diff changeset
4 " Last Change: 2022 Nov 27
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 " Only do this when not done yet for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 if exists("b:did_ftplugin")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 finish
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 " Don't load another plugin for this buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 let b:did_ftplugin = 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
14 let s:cpo_save = &cpo
20552
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
15 set cpo&vim
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
14298
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
17 if !exists('*VimFtpluginUndo')
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
18 func VimFtpluginUndo()
29403
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
19 setl fo< isk< com< tw< commentstring< include< define<
14519
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
20 if exists('b:did_add_maps')
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
21 silent! nunmap <buffer> [[
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
22 silent! vunmap <buffer> [[
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
23 silent! nunmap <buffer> ]]
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
24 silent! vunmap <buffer> ]]
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
25 silent! nunmap <buffer> []
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
26 silent! vunmap <buffer> []
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
27 silent! nunmap <buffer> ][
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
28 silent! vunmap <buffer> ][
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
29 silent! nunmap <buffer> ]"
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
30 silent! vunmap <buffer> ]"
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
31 silent! nunmap <buffer> ["
5c5908e81e93 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14298
diff changeset
32 silent! vunmap <buffer> ["
14298
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
33 endif
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
34 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
35 endfunc
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
36 endif
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
37
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
38 let b:undo_ftplugin = "call VimFtpluginUndo()"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 " Set 'formatoptions' to break comment lines but not other lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 " and insert the comment leader when hitting <CR> or using "o".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 setlocal fo-=t fo+=croql
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
44 " 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
45 " keyword character. E.g., for netrw#Nread().
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
46 setlocal isk+=#
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
47
12826
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 6213
diff changeset
48 " Use :help to lookup the keyword under the cursor with K.
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 6213
diff changeset
49 setlocal keywordprg=:help
f690da1b3c04 Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 6213
diff changeset
50
30202
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
51 " 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
52 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
53 setlocal commentstring=#%s
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
54 else
23666
96206643bd9f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
55 setlocal commentstring=\"%s
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
56 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
57
30202
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
58 " 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
59 " script.
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
60 setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#,sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"
fee9eccee266 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29659
diff changeset
61
29403
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
62 " set 'include' to recognize import commands
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
63 setlocal include=\\v^\\s*import\\s*(autoload)?
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
64
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
65 " set 'define' to recognize export commands
03e3b0034e31 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 24468
diff changeset
66 setlocal define=\\v^\\s*export\\s*(def\|const\|var\|final)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 " Format comments to be up to 78 characters long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 if &tw == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 setlocal tw=78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
73 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
74 let b:did_add_maps = 1
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
75
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
76 " Move around functions.
30547
1e91e26ceebf Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30202
diff changeset
77 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
78 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
79 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
80 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
81 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
82 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
83 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
84 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
85
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
86 " Move around comments
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
87 nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
88 vnoremap <silent><buffer> ]" :<C-U>exe "normal! gv"<Bar>call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
89 nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
90 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
91 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 " Let the matchit plugin know what items can be matched.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 if exists("loaded_matchit")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 let b:match_ignorecase = 0
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
96 " "func" can also be used as a type:
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
97 " var Ref: func
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
98 " or to list functions:
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
99 " func name
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
100 " require a parenthesis following, then there can be an "endfunc".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 let b:match_words =
31383
15c80d8bc515 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 30547
diff changeset
102 \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+\s*(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' .
24468
9f41bfdbc6fc Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
103 \ '\<\(wh\%[ile]\|for\)\>:\%(\%(^\||\)\s*\)\@<=\<brea\%[k]\>:\%(\%(^\||\)\s*\)\@<=\<con\%[tinue]\>:\%(\%(^\||\)\s*\)\@<=\<end\(w\%[hile]\|fo\%[r]\)\>,' .
9f41bfdbc6fc Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
104 \ '\<if\>:\%(\%(^\||\)\s*\)\@<=\<el\%[seif]\>:\%(\%(^\||\)\s*\)\@<=\<en\%[dif]\>,' .
19181
94eda51ba9ba patch 8.2.0149: maintaining a Vim9 branch separately is more work
Bram Moolenaar <Bram@vim.org>
parents: 14695
diff changeset
105 \ '{:},' .
24468
9f41bfdbc6fc Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
106 \ '\<try\>:\%(\%(^\||\)\s*\)\@<=\<cat\%[ch]\>:\%(\%(^\||\)\s*\)\@<=\<fina\%[lly]\>:\%(\%(^\||\)\s*\)\@<=\<endt\%[ry]\>,' .
14695
b178e2039b2d Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14519
diff changeset
107 \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,'
6213
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
108 " Ignore syntax region commands and settings, any 'en*' would clobber
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
109 " if-endif.
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
110 " - set spl=de,en
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
111 " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ …
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
112 let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name")
29659
2198955f9e27 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 29403
diff changeset
113 \ =~? "comment\\|string\\|vimLetHereDoc\\|vimSynReg\\|vimSet"'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
116 let &cpo = s:cpo_save
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
117 unlet s:cpo_save
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
118
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
119 " removed this, because 'cpoptions' is a global option.
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
120 " setlocal cpo+=M " makes \%( match \)