typescript.vim 1.2 KB

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