xref: /vim-8.2.3635/runtime/ftplugin/c.vim (revision d4755bb0)
1" Vim filetype plugin file
2" Language:	C
3" Maintainer:	Bram Moolenaar <[email protected]>
4" Last Change:	2004 Sep 01
5
6" Only do this when not done yet for this buffer
7if exists("b:did_ftplugin")
8  finish
9endif
10
11" Don't load another plugin for this buffer
12let b:did_ftplugin = 1
13
14set cpo-=C
15
16let b:undo_ftplugin = "setl cin< fo< com<"
17	\ . "| if has('vms') | setl isk< | endif"
18
19setlocal cindent
20
21" Set 'formatoptions' to break comment lines but not other lines,
22" and insert the comment leader when hitting <CR> or using "o".
23setlocal fo-=t fo+=croql
24
25" Set 'comments' to format dashed lists in comments.
26setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://
27
28" In VMS C keywords contain '$' characters.
29if has("vms")
30  setlocal iskeyword+=$
31endif
32
33" Win32 can filter files in the browse dialog
34if has("gui_win32") && !exists("b:browsefilter")
35  if &ft == "cpp"
36    let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
37	  \ "C Header Files (*.h)\t*.h\n" .
38	  \ "C Source Files (*.c)\t*.c\n" .
39	  \ "All Files (*.*)\t*.*\n"
40  elseif &ft == "ch"
41    let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" .
42	  \ "C Header Files (*.h)\t*.h\n" .
43	  \ "C Source Files (*.c)\t*.c\n" .
44	  \ "All Files (*.*)\t*.*\n"
45  else
46    let b:browsefilter = "C Source Files (*.c)\t*.c\n" .
47	  \ "C Header Files (*.h)\t*.h\n" .
48	  \ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" .
49	  \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" .
50	  \ "All Files (*.*)\t*.*\n"
51  endif
52endif
53