robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
aa1d8a2702
master
1" Vim filetype plugin file 2" Language: C 3" Maintainer: The Vim Project <https://github.com/vim/vim> 4" Last Change: 2023 Aug 22 5" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring') 6" Former Maintainer: Bram Moolenaar <Bram@vim.org> 7 8" Only do this when not done yet for this buffer 9if exists ( "b:did_ftplugin" ) 10finish 11endif 12 13" Don't load another plugin for this buffer 14let b: did_ftplugin = 1 15 16" Using line continuation here. 17let s: cpo_save = & cpo 18set cpo -= C 19 20let b: undo_ftplugin = "setl fo< com< ofu< cms< def< inc<" 21 22" Set 'formatoptions' to break comment lines but not other lines, 23" and insert the comment leader when hitting <CR> or using "o". 24setlocal fo -= tfo += croql 25 26" These options have the right value as default, but the user may have 27" overruled that. 28setlocal commentstring = /*\ %s\ */define & include & 29 30" Set completion with CTRL-X CTRL-O to autoloaded function. 31if exists ( '&ofu' ) 32setlocal ofu = ccomplete#Complete 33endif 34 35" Set 'comments' to format dashed lists in comments. 36" Also include ///, used for Doxygen. 37setlocal comments = sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,:// 38 39" When the matchit plugin is loaded, this makes the % command skip parens and 40" braces in comments properly. 41if ! exists ( "b:match_words" ) 42let b: match_words = '^\s*#\s*if\%(\|def\|ndef\)\>:^\s*#\s*elif\%(\|def\|ndef\)\>:^\s*#\s*else\>:^\s*#\s*endif\>' 43let b: match_skip = 's:comment\|string\|character\|special' 44let b: undo_ftplugin ..= " | unlet! b:match_skip b:match_words" 45endif 46 47" Win32 and GTK can filter files in the browse dialog 48if ( has ( "gui_win32" ) || has ( "gui_gtk" )) && ! exists ( "b:browsefilter" ) 49if & ft == "cpp" 50let b: browsefilter = "C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" .. 51 \"C Header Files (*.h)\t*.h\n" .. 52 \"C Source Files (*.c)\t*.c\n" 53elseif & ft == "ch" 54let b: browsefilter = "Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" .. 55 \"C Header Files (*.h)\t*.h\n" .. 56 \"C Source Files (*.c)\t*.c\n" 57else 58let b: browsefilter = "C Source Files (*.c)\t*.c\n" .. 59 \"C Header Files (*.h)\t*.h\n" .. 60 \"Ch Source Files (*.ch, *.chf)\t*.ch;*.chf\n" .. 61 \"C++ Source Files (*.cpp, *.c++)\t*.cpp;*.c++\n" 62endif 63if has ( "win32" ) 64let b: browsefilter ..= "All Files (*.*)\t*\n" 65else 66let b: browsefilter ..= "All Files (*)\t*\n" 67endif 68let b: undo_ftplugin ..= " | unlet! b:browsefilter" 69endif 70 71let b: man_default_sects = '3,2' 72let b: undo_ftplugin ..= " | unlet! b:man_default_sects" 73 74let & cpo = s: cpo_save 75unlet s: cpo_save