annotate runtime/ftplugin/c.vim @ 34146:23bb675796f0 v9.1.0034

patch 9.1.0034: Window scrolls unexpectedly when 'scrollbind' is set Commit: https://github.com/vim/vim/commit/ac4cffc6d9d307778d8a2945adab70244470bbb8 Author: Christian Brabandt <cb@256bit.org> Date: Tue Jan 16 17:22:38 2024 +0100 patch 9.1.0034: Window scrolls unexpectedly when 'scrollbind' is set Problem: Window may unexpectedly scroll when 'scrollbind' is set and setting a buffer-local option using setbufvar() (Boris Staletic) Solution: Save and restore the windows topline before opening the popup window. fixes: #13863 closes: #13869 Signed-off-by: Christian Brabandt <cb@256bit.org>
author Christian Brabandt <cb@256bit.org>
date Tue, 16 Jan 2024 17:30:10 +0100
parents 8ae680be2a51
children 7c7432a53a6c
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 file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 " Language: C
32770
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 28379
diff changeset
3 " Maintainer: The Vim Project <https://github.com/vim/vim>
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
4 " Last Change: 2023 Aug 22
32770
4027cefc2aab Farewell to Bram and dedicate upcoming Vim 9.1 to him (#12749)
Christian Brabandt <cb@256bit.org>
parents: 28379
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
233
fca8a9b65afa updated for version 7.0065
vimboss
parents: 22
diff changeset
15 " Using line continuation here.
348
7e819e81117e updated for version 7.0090
vimboss
parents: 233
diff changeset
16 let s:cpo_save = &cpo
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 set cpo-=C
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
18
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
19 let b:undo_ftplugin = "setl fo< com< ofu< cms< def< inc< | if has('vms') | setl isk< | endif"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 " Set 'formatoptions' to break comment lines but not other lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 " and insert the comment leader when hitting <CR> or using "o".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 setlocal fo-=t fo+=croql
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
19303
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
25 " These options have the right value as default, but the user may have
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
26 " overruled that.
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
27 setlocal commentstring& define& include&
51bc26d4a393 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 12756
diff changeset
28
502
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 348
diff changeset
29 " Set completion with CTRL-X CTRL-O to autoloaded function.
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 348
diff changeset
30 if exists('&ofu')
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 348
diff changeset
31 setlocal ofu=ccomplete#Complete
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 348
diff changeset
32 endif
52e76e2b5b65 updated for version 7.0140
vimboss
parents: 348
diff changeset
33
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 " Set 'comments' to format dashed lists in comments.
28379
6dd88e45d47d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25836
diff changeset
35 " Also include ///, used for Doxygen.
6dd88e45d47d Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 25836
diff changeset
36 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 " In VMS C keywords contain '$' characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 if has("vms")
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 setlocal iskeyword+=$
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 502
diff changeset
43 " When the matchit plugin is loaded, this makes the % command skip parens and
12756
3b26420fc639 Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents: 9286
diff changeset
44 " braces in comments properly.
25836
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
45 if !exists("b:match_words")
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
46 let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>'
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
47 let b:match_skip = 's:comment\|string\|character\|special'
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
48 let b:undo_ftplugin ..= " | unlet! b:match_skip b:match_words"
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
49 endif
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 502
diff changeset
50
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
51 " Win32 and GTK can filter files in the browse dialog
3682
11d40fc82f11 Updated runtime files.
Bram Moolenaar <bram@vim.org>
parents: 3082
diff changeset
52 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 if &ft == "cpp"
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
54 let b:browsefilter = "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" ..
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
55 \ "C Header Files (*.h)\t*.h\n" ..
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
56 \ "C Source Files (*.c)\t*.c\n"
22
cc049b00ee70 updated for version 7.0014
vimboss
parents: 7
diff changeset
57 elseif &ft == "ch"
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
58 let b:browsefilter = "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" ..
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
59 \ "C Header Files (*.h)\t*.h\n" ..
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
60 \ "C Source Files (*.c)\t*.c\n"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 else
34134
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
62 let b:browsefilter = "C Source Files (*.c)\t*.c\n" ..
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
63 \ "C Header Files (*.h)\t*.h\n" ..
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
64 \ "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" ..
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
65 \ "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
66 endif
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
67 if has("win32")
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
68 let b:browsefilter ..= "All Files (*.*)\t*\n"
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
69 else
8ae680be2a51 runtime(ftplugin): Use "*" browsefilter pattern to match "All Files"
Christian Brabandt <cb@256bit.org>
parents: 32770
diff changeset
70 let b:browsefilter ..= "All Files (*)\t*\n"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 endif
25836
65de67669df3 Update runtime files
Bram Moolenaar <Bram@vim.org>
parents: 19303
diff changeset
72 let b:undo_ftplugin ..= " | unlet! b:browsefilter"
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 endif
348
7e819e81117e updated for version 7.0090
vimboss
parents: 233
diff changeset
74
7e819e81117e updated for version 7.0090
vimboss
parents: 233
diff changeset
75 let &cpo = s:cpo_save
7e819e81117e updated for version 7.0090
vimboss
parents: 233
diff changeset
76 unlet s:cpo_save