hare.vim 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. " Vim filetype plugin.
  2. " Language: Hare
  3. " Maintainer: Amelia Clarke <selene@perilune.dev>
  4. " Last Updated: 2024 Oct 04
  5. " Upstream: https://git.sr.ht/~sircmpwn/hare.vim
  6. if exists('b:did_ftplugin')
  7. finish
  8. endif
  9. let b:did_ftplugin = 1
  10. let s:cpo_save = &cpo
  11. set cpo&vim
  12. " Formatting settings.
  13. setlocal comments=://
  14. setlocal commentstring=//\ %s
  15. setlocal formatlistpat=^\ \\?-\
  16. setlocal formatoptions+=croqnlj/ formatoptions-=t
  17. " Search for Hare modules.
  18. setlocal include=^\\s*use\\>
  19. setlocal includeexpr=hare#FindModule(v:fname)
  20. setlocal isfname+=:
  21. setlocal suffixesadd=.ha
  22. " Add HAREPATH to the default search paths.
  23. setlocal path-=/usr/include,,
  24. let &l:path .= ',' .. hare#GetPath() .. ',,'
  25. let b:undo_ftplugin = 'setl cms< com< flp< fo< inc< inex< isf< pa< sua< mp<'
  26. " Follow the Hare style guide by default.
  27. if get(g:, 'hare_recommended_style', 1)
  28. setlocal noexpandtab
  29. setlocal shiftwidth=0
  30. setlocal softtabstop=0
  31. setlocal tabstop=8
  32. setlocal textwidth=80
  33. let b:undo_ftplugin .= ' et< sts< sw< ts< tw<'
  34. endif
  35. augroup hare.vim
  36. autocmd!
  37. " Highlight whitespace errors by default.
  38. if get(g:, 'hare_space_error', 1)
  39. autocmd InsertEnter * hi link hareSpaceError NONE
  40. autocmd InsertLeave * hi link hareSpaceError Error
  41. endif
  42. augroup END
  43. if !exists('current_compiler')
  44. let b:undo_ftplugin .= "| compiler make"
  45. compiler hare
  46. endif
  47. let &cpo = s:cpo_save
  48. unlet s:cpo_save
  49. " vim: et sts=2 sw=2 ts=8