1" Vim filetype plugin file 2" Language: C 3" Maintainer: Bram Moolenaar <[email protected]> 4" Last Change: 2005 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 14" Using line continuation here. 15let s:cpo_save = &cpo 16set cpo-=C 17 18let b:undo_ftplugin = "setl fo< com< ofu< | if has('vms') | setl isk< | endif" 19 20" Set 'formatoptions' to break comment lines but not other lines, 21" and insert the comment leader when hitting <CR> or using "o". 22setlocal fo-=t fo+=croql 23 24" Set completion with CTRL-X CTRL-O to autoloaded function. 25if exists('&ofu') 26 setlocal ofu=ccomplete#Complete 27endif 28 29" Set 'comments' to format dashed lists in comments. 30setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// 31 32" In VMS C keywords contain '$' characters. 33if has("vms") 34 setlocal iskeyword+=$ 35endif 36 37" Win32 can filter files in the browse dialog 38if has("gui_win32") && !exists("b:browsefilter") 39 if &ft == "cpp" 40 let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . 41 \ "C Header Files (*.h)\t*.h\n" . 42 \ "C Source Files (*.c)\t*.c\n" . 43 \ "All Files (*.*)\t*.*\n" 44 elseif &ft == "ch" 45 let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . 46 \ "C Header Files (*.h)\t*.h\n" . 47 \ "C Source Files (*.c)\t*.c\n" . 48 \ "All Files (*.*)\t*.*\n" 49 else 50 let b:browsefilter = "C Source Files (*.c)\t*.c\n" . 51 \ "C Header Files (*.h)\t*.h\n" . 52 \ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . 53 \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . 54 \ "All Files (*.*)\t*.*\n" 55 endif 56endif 57 58let &cpo = s:cpo_save 59unlet s:cpo_save 60