blob: cf6686c72bd29f3e848b51d390affe8504a4f349 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim filetype plugin file
2" Language: C
3" Maintainer: Bram Moolenaar <Bram@vim.org>
Bram Moolenaard4755bb2004-09-02 19:12:26 +00004" Last Change: 2004 Sep 01
Bram Moolenaar071d4272004-06-13 20:20:40 +00005
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"
Bram Moolenaard4755bb2004-09-02 19:12:26 +000040 elseif &ft == "ch"
Bram Moolenaar071d4272004-06-13 20:20:40 +000041 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