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> |
Bram Moolenaar | 582fd85 | 2005-03-28 20:58:01 +0000 | [diff] [blame] | 4 | " Last Change: 2005 Mar 27 |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 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 | |
Bram Moolenaar | 582fd85 | 2005-03-28 20:58:01 +0000 | [diff] [blame] | 14 | " Using line continuation here. |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 15 | set cpo-=C |
| 16 | |
Bram Moolenaar | 582fd85 | 2005-03-28 20:58:01 +0000 | [diff] [blame] | 17 | let b:undo_ftplugin = "setl fo< com< | if has('vms') | setl isk< | endif" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 18 | |
| 19 | " Set 'formatoptions' to break comment lines but not other lines, |
| 20 | " and insert the comment leader when hitting <CR> or using "o". |
| 21 | setlocal fo-=t fo+=croql |
| 22 | |
| 23 | " Set 'comments' to format dashed lists in comments. |
| 24 | setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// |
| 25 | |
| 26 | " In VMS C keywords contain '$' characters. |
| 27 | if has("vms") |
| 28 | setlocal iskeyword+=$ |
| 29 | endif |
| 30 | |
| 31 | " Win32 can filter files in the browse dialog |
| 32 | if has("gui_win32") && !exists("b:browsefilter") |
| 33 | if &ft == "cpp" |
| 34 | let b:browsefilter = "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . |
| 35 | \ "C Header Files (*.h)\t*.h\n" . |
| 36 | \ "C Source Files (*.c)\t*.c\n" . |
| 37 | \ "All Files (*.*)\t*.*\n" |
Bram Moolenaar | d4755bb | 2004-09-02 19:12:26 +0000 | [diff] [blame] | 38 | elseif &ft == "ch" |
Bram Moolenaar | 071d427 | 2004-06-13 20:20:40 +0000 | [diff] [blame] | 39 | let b:browsefilter = "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . |
| 40 | \ "C Header Files (*.h)\t*.h\n" . |
| 41 | \ "C Source Files (*.c)\t*.c\n" . |
| 42 | \ "All Files (*.*)\t*.*\n" |
| 43 | else |
| 44 | let b:browsefilter = "C Source Files (*.c)\t*.c\n" . |
| 45 | \ "C Header Files (*.h)\t*.h\n" . |
| 46 | \ "Ch Source Files (*.ch *.chf)\t*.ch;*.chf\n" . |
| 47 | \ "C++ Source Files (*.cpp *.c++)\t*.cpp;*.c++\n" . |
| 48 | \ "All Files (*.*)\t*.*\n" |
| 49 | endif |
| 50 | endif |