annotate runtime/ftplugin/vim.vim @ 24468:9f41bfdbc6fc

Update runtime files. Commit: https://github.com/vim/vim/commit/56994d215815139207f3c5ce02a1720e44e93c09 Author: Bram Moolenaar <Bram@vim.org> Date: Sat Apr 17 16:31:09 2021 +0200 Update runtime files.
author Bram Moolenaar <Bram@vim.org>
date Sat, 17 Apr 2021 16:45:04 +0200
parents ef454a7f485d
children 03e3b0034e31
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>
24468
9f41bfdbc6fc Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
4 " Last Change: 2021 Apr 11
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()
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
19 setl fo< isk< com< tw< commentstring<
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
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
51 if "\n" .. getline(1, 10)->join("\n") =~# '\n\s*vim9\%[script]\>'
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
52 " Set 'comments' to format dashed lists in comments
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
53 setlocal com=sO:#\ -,mO:#\ \ ,eO:##,:#
23666
96206643bd9f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
54 " Comments starts with # in Vim9 script
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 else
24024
ef454a7f485d Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23931
diff changeset
57 setlocal com=sO:\"\ -,mO:\"\ \ ,eO:\"\",:\"
23666
96206643bd9f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
58 " Comments starts with a double quote in legacy script
96206643bd9f Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23573
diff changeset
59 setlocal commentstring=\"%s
23573
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
60 endif
e2e2cc5d0856 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21825
diff changeset
61
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 " Format comments to be up to 78 characters long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 if &tw == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 setlocal tw=78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
68 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
69 let b:did_add_maps = 1
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
70
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
71 " Move around functions.
20552
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
72 nnoremap <silent><buffer> [[ m':call search('^\s*\(fu\%[nction]\\|def\)\>', "bW")<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
73 vnoremap <silent><buffer> [[ m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|def\)\>', "bW")<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
74 nnoremap <silent><buffer> ]] m':call search('^\s*\(fu\%[nction]\\|def\)\>', "W")<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
75 vnoremap <silent><buffer> ]] m':<C-U>exe "normal! gv"<Bar>call search('^\s*\(fu\%[nction]\\|def\)\>', "W")<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
76 nnoremap <silent><buffer> [] m':call search('^\s*end\(f\%[unction]\\|def\)\>', "bW")<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
77 vnoremap <silent><buffer> [] m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|def\)\>', "bW")<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
78 nnoremap <silent><buffer> ][ m':call search('^\s*end\(f\%[unction]\\|def\)\>', "W")<CR>
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
79 vnoremap <silent><buffer> ][ m':<C-U>exe "normal! gv"<Bar>call search('^\s*end\(f\%[unction]\\|def\)\>', "W")<CR>
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
81 " Move around comments
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
82 nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
83 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
84 nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
85 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
86 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 " Let the matchit plugin know what items can be matched.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 if exists("loaded_matchit")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 let b:match_ignorecase = 0
23737
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
91 " "func" can also be used as a type:
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
92 " var Ref: func
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
93 " or to list functions:
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
94 " func name
34b4eb3a8458 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 23666
diff changeset
95 " require a parenthesis following, then there can be an "endfunc".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 let b:match_words =
24468
9f41bfdbc6fc Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
97 \ '\<\%(fu\%[nction]\|def\)!\=\s\+\S\+(:\%(\%(^\||\)\s*\)\@<=\<retu\%[rn]\>:\%(\%(^\||\)\s*\)\@<=\<\%(endf\%[unction]\|enddef\)\>,' .
9f41bfdbc6fc Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
98 \ '\<\(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
99 \ '\<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
100 \ '{:},' .
24468
9f41bfdbc6fc Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 24024
diff changeset
101 \ '\<try\>:\%(\%(^\||\)\s*\)\@<=\<cat\%[ch]\>:\%(\%(^\||\)\s*\)\@<=\<fina\%[lly]\>:\%(\%(^\||\)\s*\)\@<=\<endt\%[ry]\>,' .
14695
b178e2039b2d Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14519
diff changeset
102 \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,'
6213
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
103 " Ignore syntax region commands and settings, any 'en*' would clobber
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
104 " if-endif.
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
105 " - set spl=de,en
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
106 " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ …
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
107 let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name")
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
108 \ =~? "comment\\|string\\|vimSynReg\\|vimSet"'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
111 let &cpo = s:cpo_save
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
112 unlet s:cpo_save
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
113
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
114 " removed this, because 'cpoptions' is a global option.
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
115 " setlocal cpo+=M " makes \%( match \)