osacompile.vim 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "==============================================================================
  2. " FileName: applescript.vim
  3. " Desc: Syntax checking plugin for syntastic.vim
  4. " Author: Zhao Cai
  5. " Email: caizhaoff@gmail.com
  6. " Version: 0.2.1
  7. " Date Created: Thu 09 Sep 2011 10:30:09 AM EST
  8. " Last Modified: Fri 09 Dec 2011 01:10:24 PM EST
  9. "
  10. " History: 0.1.0 - working, but it will run the script everytime to check
  11. " syntax. Should use osacompile but strangely it does not give
  12. " errors.
  13. "
  14. " 0.2.0 - switch to osacompile, it gives less errors compared
  15. " with osascript.
  16. "
  17. " 0.2.1 - remove g:syntastic_applescript_tempfile. use
  18. " tempname() instead.
  19. "
  20. " License: This program is free software. It comes without any
  21. " warranty, to the extent permitted by applicable law. You can
  22. " redistribute it and/or modify it under the terms of the Do What The
  23. " Fuck You Want To Public License, Version 2, as published by Sam
  24. " Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details.
  25. "
  26. "============================================================================
  27. if exists('g:loaded_syntastic_applescript_osacompile_checker')
  28. finish
  29. endif
  30. let g:loaded_syntastic_applescript_osacompile_checker = 1
  31. let s:save_cpo = &cpo
  32. set cpo&vim
  33. function! SyntaxCheckers_applescript_osacompile_GetLocList() dict
  34. let makeprg = self.makeprgBuild({ 'args_after': '-o ' . tempname() . '.scpt' })
  35. let errorformat = '%f:%l:%m'
  36. return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
  37. endfunction
  38. call g:SyntasticRegistry.CreateAndRegisterChecker({
  39. \ 'filetype': 'applescript',
  40. \ 'name': 'osacompile' })
  41. let &cpo = s:save_cpo
  42. unlet s:save_cpo
  43. " vim: set sw=4 sts=4 et fdm=marker: