Mercurial > vim
annotate runtime/ftplugin/c.vim @ 19676:db11dd62388b
Added tag v8.2.0394 for changeset bee179e81f28538cca12cde8b40261285e420b6a
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 16 Mar 2020 20:30:04 +0100 |
parents | 51bc26d4a393 |
children | 65de67669df3 |
rev | line source |
---|---|
7 | 1 " Vim filetype plugin file |
2 " Language: C | |
3 " Maintainer: Bram Moolenaar <Bram@vim.org> | |
19303 | 4 " Last Change: 2020 Feb 01 |
7 | 5 |
6 " Only do this when not done yet for this buffer | |
7 if exists("b:did_ftplugin") | |
8 finish | |
9 endif | |
10 | |
11 " Don't load another plugin for this buffer | |
12 let b:did_ftplugin = 1 | |
13 | |
233 | 14 " Using line continuation here. |
348 | 15 let s:cpo_save = &cpo |
7 | 16 set cpo-=C |
17 | |
19303 | 18 let b:undo_ftplugin = "setl fo< com< ofu< cms< def< inc< | if has('vms') | setl isk< | endif" |
7 | 19 |
20 " Set 'formatoptions' to break comment lines but not other lines, | |
21 " and insert the comment leader when hitting <CR> or using "o". | |
22 setlocal fo-=t fo+=croql | |
23 | |
19303 | 24 " These options have the right value as default, but the user may have |
25 " overruled that. | |
26 setlocal commentstring& define& include& | |
27 | |
502 | 28 " Set completion with CTRL-X CTRL-O to autoloaded function. |
29 if exists('&ofu') | |
30 setlocal ofu=ccomplete#Complete | |
31 endif | |
32 | |
7 | 33 " Set 'comments' to format dashed lists in comments. |
34 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// | |
35 | |
36 " In VMS C keywords contain '$' characters. | |
37 if has("vms") | |
38 setlocal iskeyword+=$ | |
39 endif | |
40 | |
1621 | 41 " 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
|
42 " braces in comments properly. |
3b26420fc639
Long overdue runtime update.
Christian Brabandt <cb@256bit.org>
parents:
9286
diff
changeset
|
43 let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>' |
9286
64035abb986b
commit https://github.com/vim/vim/commit/c95a302a4c42ec8230473cd4a5e0064d0a143aa8
Christian Brabandt <cb@256bit.org>
parents:
3682
diff
changeset
|
44 let b:match_skip = 's:comment\|string\|character\|special' |
1621 | 45 |
7 | 46 " Win32 can filter files in the browse dialog |
3682 | 47 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") |
7 | 48 if &ft == "cpp" |
49 let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . | |
50 \ "C Header Files (*.h)\t*.h\n" . | |
51 \ "C Source Files (*.c)\t*.c\n" . | |
52 \ "All Files (*.*)\t*.*\n" | |
22 | 53 elseif &ft == "ch" |
7 | 54 let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . |
55 \ "C Header Files (*.h)\t*.h\n" . | |
56 \ "C Source Files (*.c)\t*.c\n" . | |
57 \ "All Files (*.*)\t*.*\n" | |
58 else | |
59 let b:browsefilter = "C Source Files (*.c)\t*.c\n" . | |
60 \ "C Header Files (*.h)\t*.h\n" . | |
61 \ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . | |
62 \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . | |
63 \ "All Files (*.*)\t*.*\n" | |
64 endif | |
65 endif | |
348 | 66 |
67 let &cpo = s:cpo_save | |
68 unlet s:cpo_save |