codekingpro/portable-devtools
114k
1" Vim filetype plugin file2" Language: Arduino3" Maintainer: The Vim Project <https://github.com/vim/vim>4" Ken Takata <https://github.com/k-takata>5" Last Change: 2024 Apr 126" 2024 Jun 02 by Riley Bruins <ribru17@gmail.com> ('commentstring')7"8" Most of the part was copied from c.vim.9 10" Only do this when not done yet for this buffer11if exists("b:did_ftplugin")12 finish13endif14 15" Don't load another plugin for this buffer16let b:did_ftplugin = 117 18" Using line continuation here.19let s:cpo_save = &cpo20set cpo-=C21 22let b:undo_ftplugin = "setl fo< com< ofu< cms< def< inc<"23 24if !exists("g:arduino_recommended_style") || g:arduino_recommended_style != 025 " Use the default setting of Arduino IDE.26 setlocal expandtab tabstop=2 softtabstop=2 shiftwidth=227 let b:undo_ftplugin ..= " et< ts< sts< sw<"28endif29 30" Set 'formatoptions' to break comment lines but not other lines,31" and insert the comment leader when hitting <CR> or using "o".32setlocal fo-=t fo+=croql33 34" These options have the right value as default, but the user may have35" overruled that.36setlocal commentstring=/*\ %s\ */ define& include&37 38" Set completion with CTRL-X CTRL-O to autoloaded function.39if exists('&ofu')40 setlocal ofu=ccomplete#Complete41endif42 43" Set 'comments' to format dashed lists in comments.44" Also include ///, used for Doxygen.45setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:///,://46 47" When the matchit plugin is loaded, this makes the % command skip parens and48" braces in comments properly.49if !exists("b:match_words")50 let b:match_words = '^\s*#\s*if\(\|def\|ndef\)\>:^\s*#\s*elif\>:^\s*#\s*else\>:^\s*#\s*endif\>'51 let b:match_skip = 's:comment\|string\|character\|special'52 let b:undo_ftplugin ..= " | unlet! b:match_skip b:match_words"53endif54 55" Win32 and GTK can filter files in the browse dialog56if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")57 let b:browsefilter = "Arduino Source Files (*.ino, *.pde)\t*.ino;*.pde\n"58 if has("win32")59 let b:browsefilter ..= "All Files (*.*)\t*\n"60 else61 let b:browsefilter ..= "All Files (*)\t*\n"62 endif63 let b:undo_ftplugin ..= " | unlet! b:browsefilter"64endif65 66let &cpo = s:cpo_save67unlet s:cpo_save68 