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