racket.vim 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. " Vim indent file
  2. " Language: Racket
  3. " Maintainer: D. Ben Knoble <ben.knoble+github@gmail.com>
  4. " Previous Maintainer: Will Langstroth <will@langstroth.com>
  5. " URL: https://github.com/benknoble/vim-racket
  6. " Last Change: 2024 Nov 12
  7. if exists("b:did_indent")
  8. finish
  9. endif
  10. let b:did_indent = 1
  11. setlocal lisp autoindent nosmartindent
  12. if has('vim9script')
  13. setlocal indentexpr=racket#Indent() lispoptions+=expr:1
  14. endif
  15. setlocal lispwords+=module,module*,module+,parameterize,parameterize*,let-values,let*-values,letrec-values,local
  16. setlocal lispwords+=define/contract
  17. setlocal lispwords+=λ
  18. setlocal lispwords+=with-handlers
  19. setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse
  20. setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class
  21. setlocal lispwords+=syntax/loc,quasisyntax/loc
  22. setlocal lispwords+=define-syntax-parameter,syntax-parameterize
  23. setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig
  24. setlocal lispwords+=define-opt/c,define-syntax-rule
  25. setlocal lispwords+=define-test-suite,test-case
  26. setlocal lispwords+=struct
  27. setlocal lispwords+=with-input-from-file,with-output-to-file
  28. setlocal lispwords+=begin,begin0
  29. setlocal lispwords+=place
  30. setlocal lispwords+=cond
  31. " Racket style indents if like a function application:
  32. " (if test
  33. " then
  34. " else)
  35. setlocal lispwords-=if
  36. " Racket OOP
  37. " TODO missing a lot of define-like forms here (e.g., define/augment, etc.)
  38. setlocal lispwords+=class,class*,mixin,interface,class/derived
  39. setlocal lispwords+=define/public,define/pubment,define/public-final
  40. setlocal lispwords+=define/override,define/overment,define/override-final
  41. setlocal lispwords+=define/augment,define/augride,define/augment-final
  42. setlocal lispwords+=define/private
  43. " kanren
  44. setlocal lispwords+=fresh,run,run*,project,conde,condu
  45. " loops
  46. setlocal lispwords+=for,for/list,for/fold,for*,for*/list,for*/fold,for/or,for/and,for*/or,for*/and
  47. setlocal lispwords+=for/hash,for/hasheq,for/hasheqv,for/sum,for/flvector,for*/flvector,for/vector,for*/vector,for*/sum,for*/hash,for*/hasheq,for*/hasheqv
  48. setlocal lispwords+=for/async
  49. setlocal lispwords+=for/set,for*/set
  50. setlocal lispwords+=for/first,for*/first
  51. setlocal lispwords+=for/last,for*/last
  52. setlocal lispwords+=for/stream,for*/stream
  53. setlocal lispwords+=for/lists,for*/lists
  54. setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda**
  55. setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values
  56. setlocal lispwords+=match-letrec,match-define,match-define-values
  57. setlocal lispwords+=let/cc,let/ec
  58. " qi
  59. setlocal lispwords+=define-flow,define-switch,flow-lambda,switch-lambda,on,switch,π,λ01
  60. setlocal lispwords+=define-qi-syntax,define-qi-syntax-parser,define-qi-syntax-rule
  61. " gui-easy
  62. setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view
  63. setlocal lispwords+=case/dep
  64. setlocal lispwords+=define/obs
  65. " rackunit
  66. setlocal lispwords+=define-simple-check,define-binary-check,define-check,with-check-info
  67. let b:undo_indent = "setlocal lisp< ai< si< lw<" .. (has('vim9script') ? ' indentexpr< lispoptions<' : '')