Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 1 | " Vim filetype plugin file |
| 2 | " Language: C |
| 3 | " Maintainer: Bram Moolenaar <Bram@vim.org> |
| 4 | " Last Change: 2004 May 16 |
| 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 | |
| 14 | set cpo-=C |
| 15 | |
| 16 | let b:undo_ftplugin = "setl cin< fo< com<" |
| 17 | \ . "| if has('vms') | setl isk< | endif" |
| 18 | |
| 19 | setlocal 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". |
| 23 | setlocal fo-=t fo+=croql |
| 24 | |
| 25 | " Set 'comments' to format dashed lists in comments. |
| 26 | setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// |
| 27 | |
| 28 | " In VMS C keywords contain '$' characters. |
| 29 | if has("vms") |
| 30 | setlocal iskeyword+=$ |
| 31 | endif |
| 32 | |
| 33 | " Win32 can filter files in the browse dialog |
| 34 | if 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 == "chscript" |
| 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 |
| 52 | endif |