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