annotate runtime/ftplugin/vim.vim @ 23386:3105546b941f v8.2.2236

patch 8.2.2236: 'scroll' option can change when setting the statusline Commit: https://github.com/vim/vim/commit/746670604a60cb0356b56c112ffb6d297c679099 Author: Bram Moolenaar <Bram@vim.org> Date: Mon Dec 28 15:41:41 2020 +0100 patch 8.2.2236: 'scroll' option can change when setting the statusline Problem: 'scroll' option can change when setting the statusline or tabline but the option context is not updated. Solution: Update the script context when the scroll option is changed as a side effect. (Christian Brabandt, closes #7533)
author Bram Moolenaar <Bram@vim.org>
date Mon, 28 Dec 2020 15:45:03 +0100
parents 0db0640e16e0
children e2e2cc5d0856
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>
21825
0db0640e16e0 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
4 " Last Change: 2020 Aug 14
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
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 " Set 'comments' to format dashed lists in comments
21825
0db0640e16e0 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
52 " Avoid that #{} starts a comment.
0db0640e16e0 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21676
diff changeset
53 setlocal com=sO:\"\ -,mO:\"\ \ ,sO:#\ -,mO:#\ \ ,eO:##,:\",b:#
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 " Format comments to be up to 78 characters long
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 if &tw == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 setlocal tw=78
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59
21250
21fb2a3ad3ca Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 20965
diff changeset
60 " Comments start with a double quote; in Vim9 script # would also work
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 setlocal commentstring=\"%s
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
63 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
64 let b:did_add_maps = 1
4a588e3afd4a Update runtime files, add Danish translations.
Christian Brabandt <cb@256bit.org>
parents: 13051
diff changeset
65
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
66 " Move around functions.
20552
74e3316c1d5a Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19181
diff changeset
67 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
68 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
69 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
70 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
71 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
72 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
73 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
74 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
75
13051
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
76 " Move around comments
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
77 nnoremap <silent><buffer> ]" :call search('^\(\s*".*\n\)\@<!\(\s*"\)', "W")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
78 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
79 nnoremap <silent><buffer> [" :call search('\%(^\s*".*\n\)\%(^\s*"\)\@!', "bW")<CR>
a6d3e2081544 Update runtime files
Christian Brabandt <cb@256bit.org>
parents: 12826
diff changeset
80 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
81 endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 " Let the matchit plugin know what items can be matched.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 if exists("loaded_matchit")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 let b:match_ignorecase = 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 let b:match_words =
21676
1b345fb68ae3 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 21499
diff changeset
87 \ '\<\%(fu\%[nction]\|def\)\>)\@!:\<retu\%[rn]\>:\<\%(endf\%[unction]\|enddef\)\>,' .
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
88 \ '\<\(wh\%[ile]\|for\)\>:\<brea\%[k]\>:\<con\%[tinue]\>:\<end\(w\%[hile]\|fo\%[r]\)\>,' .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 \ '\<if\>:\<el\%[seif]\>:\<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
90 \ '{:},' .
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 \ '\<try\>:\<cat\%[ch]\>:\<fina\%[lly]\>:\<endt\%[ry]\>,' .
14695
b178e2039b2d Update runtime files.
Christian Brabandt <cb@256bit.org>
parents: 14519
diff changeset
92 \ '\<aug\%[roup]\s\+\%(END\>\)\@!\S:\<aug\%[roup]\s\+END\>,'
6213
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
93 " Ignore syntax region commands and settings, any 'en*' would clobber
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
94 " if-endif.
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
95 " - set spl=de,en
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
96 " - au! FileType javascript syntax region foldBraces start=/{/ end=/}/ …
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
97 let b:match_skip = 'synIDattr(synID(line("."),col("."),1),"name")
37c24033b260 Update runtime files.
Bram Moolenaar <bram@vim.org>
parents: 5024
diff changeset
98 \ =~? "comment\\|string\\|vimSynReg\\|vimSet"'
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100
2034
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
101 let &cpo = s:cpo_save
7bc41231fbc7 Update runtime files.
Bram Moolenaar <bram@zimbu.org>
parents: 1622
diff changeset
102 unlet s:cpo_save
168
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
103
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
104 " removed this, because 'cpoptions' is a global option.
4d9eabb1396e updated for version 7.0051
vimboss
parents: 24
diff changeset
105 " setlocal cpo+=M " makes \%( match \)