codekingpro/portable-devtools
114k
1" Vim filetype plugin file2" Language: Javascript3" Maintainer: Doug Kearns <dougkearns@gmail.com>4" Contributor: Romain Lafourcade <romainlafourcade@gmail.com>5" Last Change: 2024 Jan 146" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring')7 8if exists("b:did_ftplugin")9 finish10endif11let b:did_ftplugin = 112 13let s:cpo_save = &cpo14set cpo-=C15 16" Set 'formatoptions' to break comment lines but not other lines,17" and insert the comment leader when hitting <CR> or using "o".18setlocal formatoptions-=t formatoptions+=croql19 20" Set completion with CTRL-X CTRL-O to autoloaded function.21if exists('&ofu')22 setlocal omnifunc=javascriptcomplete#CompleteJS23endif24 25" Set 'comments' to format dashed lists in comments.26setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,://27 28setlocal commentstring=//\ %s29 30" Change the :browse e filter to primarily show JavaScript-related files.31if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter")32 let b:browsefilter =33 \ "JavaScript Files (*.js)\t*.js\n"34 \ .. "JSX Files (*.jsx)\t*.jsx\n"35 \ .. "JavaScript Modules (*.es, *.es6, *.cjs, *.mjs, *.jsm)\t*.es;*.es6;*.cjs;*.mjs;*.jsm\n"36 \ .. "Vue Templates (*.vue)\t*.vue\n"37 \ .. "JSON Files (*.json)\t*.json\n"38 if has("win32")39 let b:browsefilter ..= "All Files (*.*)\t*\n"40 else41 let b:browsefilter ..= "All Files (*)\t*\n"42 endif43endif44 45" The following suffixes should be implied when resolving filenames46setlocal suffixesadd+=.js,.jsx,.es,.es6,.cjs,.mjs,.jsm,.vue,.json47 48" The following suffixes should have low priority49" .snap jest snapshot50setlocal suffixes+=.snap51 52" Remove irrelevant part of 'path'.53" User is expected to augment it with contextually-relevant paths54setlocal path-=/usr/include55 56" Matchit configuration57if exists("loaded_matchit")58 let b:match_ignorecase = 059 let b:match_words =60 \ '\<do\>:\<while\>,'61 \ .. '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,'62 \ .. '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>'63endif64 65" Set 'define' to a comprehensive value66let &l:define =67 \ '\(^\s*(*async\s\+function\|(*function\)'68 \ .. '\|^\s*\(\*\|static\|async\|get\|set\|\i\+\.\)'69 \ .. '\|^\s*\(\ze\i\+\)\(([^)]*).*{$\|\s*[:=,]\)'70 \ .. '\|^\s*\(export\s\+\|export\s\+default\s\+\)*\(var\|let\|const\|function\|class\)'71 \ .. '\|\<as\>'72 73let b:undo_ftplugin =74 \ "setl fo< ofu< com< cms< sua< su< def< pa<"75 \ .. "| unlet! b:browsefilter b:match_ignorecase b:match_words"76 77let &cpo = s:cpo_save78unlet s:cpo_save79 80" vim: textwidth=78 tabstop=8 shiftwidth=4 softtabstop=4 expandtab81 