nix.vim 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "============================================================================
  2. "File: nix.vim
  3. "Description: Check nix syntax using 'nix-instantiate --eval-only'
  4. "Maintainer: Tim Cuthbertson <tim@gfxmonk.net>
  5. "License: This program is free software. It comes without any warranty,
  6. " to the extent permitted by applicable law. You can redistribute
  7. " it and/or modify it under the terms of the Do What The Fuck You
  8. " Want To Public License, Version 2, as published by Sam Hocevar.
  9. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  10. "
  11. "============================================================================
  12. "
  13. "
  14. if exists('g:loaded_syntastic_nix_nix_checker')
  15. finish
  16. endif
  17. let g:loaded_syntastic_nix_nix_checker = 1
  18. let s:save_cpo = &cpo
  19. set cpo&vim
  20. function! SyntaxCheckers_nix_nix_GetLocList() dict
  21. let makeprg = self.makeprgBuild({ 'args_after': '--parse-only' })
  22. let errorformat =
  23. \ '%f:%l:%c:%m,' .
  24. \ '%f:%l:%m,' .
  25. \ '%f:%m'
  26. return SyntasticMake({
  27. \ 'makeprg': makeprg,
  28. \ 'errorformat': errorformat,
  29. \ 'defaults': {'type': 'e'},
  30. \ 'preprocess': 'nix' })
  31. endfunction
  32. call g:SyntasticRegistry.CreateAndRegisterChecker({
  33. \ 'filetype': 'nix',
  34. \ 'name': 'nix',
  35. \ 'exec': 'nix-instantiate' })
  36. let &cpo = s:save_cpo
  37. unlet s:save_cpo
  38. " vim: set sw=4 sts=4 et fdm=marker: