typescript.vim (1404B)
1 " Vim filetype plugin file 2 " Language: TypeScript 3 " Maintainer: Doug Kearns <dougkearns@gmail.com> 4 " Last Change: 2024 Jan 14 5 " 2024 May 23 by Riley Bruins <ribru17@gmail.com> ('commentstring') 6 7 if exists("b:did_ftplugin") 8 finish 9 endif 10 let b:did_ftplugin = 1 11 12 let s:cpo_save = &cpo 13 set cpo-=C 14 15 " Set 'formatoptions' to break comment lines but not other lines, 16 " and insert the comment leader when hitting <CR> or using "o". 17 setlocal formatoptions-=t formatoptions+=croql 18 19 " Set 'comments' to format dashed lists in comments. 20 setlocal comments=sO:*\ -,mO:*\ \ ,exO:*/,s1:/*,mb:*,ex:*/,:// 21 22 setlocal commentstring=//\ %s 23 24 setlocal suffixesadd+=.ts,.d.ts,.tsx,.js,.jsx,.cjs,.mjs 25 26 let b:undo_ftplugin = "setl fo< com< cms< sua<" 27 28 " Change the :browse e filter to primarily show TypeScript-related files. 29 if (has("gui_win32") || has("gui_gtk")) && !exists("b:browsefilter") 30 let b:browsefilter="TypeScript Files (*.ts)\t*.ts\n" . 31 \ "TypeScript Declaration Files (*.d.ts)\t*.d.ts\n" . 32 \ "TSX Files (*.tsx)\t*.tsx\n" . 33 \ "JavaScript Files (*.js)\t*.js\n" . 34 \ "JavaScript Modules (*.es, *.cjs, *.mjs)\t*.es;*.cjs;*.mjs\n" . 35 \ "JSON Files (*.json)\t*.json\n" 36 if has("win32") 37 let b:browsefilter .= "All Files (*.*)\t*\n" 38 else 39 let b:browsefilter .= "All Files (*)\t*\n" 40 endif 41 let b:undo_ftplugin .= " | unlet! b:browsefilter" 42 endif 43 44 let &cpo = s:cpo_save 45 unlet s:cpo_save