robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
2f5b8a0092
master
1" Vim filetype plugin file 2" Language: Javascript 3" Maintainer: Doug Kearns <dougkearns@gmail.com> 4" Contributor: Romain Lafourcade <romainlafourcade@gmail.com> 5" Last Change: 2024 Jan 14 6" 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') 7 8if exists ( "b:did_ftplugin" ) 9finish 10endif 11let b: did_ftplugin = 1 12 13let s: cpo_save = & cpo 14set cpo -= C 15 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 -= tformatoptions += croql 19 20" Set completion with CTRL-X CTRL-O to autoloaded function. 21if exists ( '&ofu' ) 22setlocal omnifunc = javascriptcomplete#CompleteJS 23endif 24 25" Set 'comments' to format dashed lists in comments. 26setlocal comments = sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// 27 28setlocal commentstring = //\ %s 29 30" Change the :browse e filter to primarily show JavaScript-related files. 31if ( has ( "gui_win32" ) || has ( "gui_gtk" )) && ! exists ( "b:browsefilter" ) 32let 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" 38if has ( "win32" ) 39let b: browsefilter ..= "All Files (*.*)\t*\n" 40else 41let b: browsefilter ..= "All Files (*)\t*\n" 42endif 43endif 44 45" The following suffixes should be implied when resolving filenames 46setlocal suffixesadd += .js,.jsx,.es,.es6,.cjs,.mjs,.jsm,.vue,.json 47 48" The following suffixes should have low priority 49" .snap jest snapshot 50setlocal suffixes += .snap 51 52" Remove irrelevant part of 'path'. 53" User is expected to augment it with contextually-relevant paths 54setlocal path -= /usr/include 55 56" Matchit configuration 57if exists ( "loaded_matchit" ) 58let b: match_ignorecase = 0 59let b: match_words = 60 \'\<do\>:\<while\>,' 61 \.. '<\@<=\([^ \t>/]\+\)\%(\s\+[^>]*\%([^/]>\|$\)\|>\|$\):<\@<=/\1>,' 62 \.. '<\@<=\%([^ \t>/]\+\)\%(\s\+[^/>]*\|$\):/>' 63endif 64 65" Set 'define' to a comprehensive value 66let & 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_save 78unlet s: cpo_save 79 80" vim: textwidth=78 tabstop=8 shiftwidth=4 softtabstop=4 expandtab