blob: 2bab3f3bed35d28e156e4451b6d811172aeb476e [file] [log] [blame]
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +01001" 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
D. Ben Knoble8e013b12024-11-13 19:45:38 +01006" Last Change: 2024 Nov 12
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +01007
8if exists("b:did_indent")
9 finish
10endif
11let b:did_indent = 1
12
13setlocal lisp autoindent nosmartindent
D. Ben Knoble5eb9cb52023-12-16 08:24:15 -050014if has('vim9script')
15 setlocal indentexpr=racket#Indent() lispoptions+=expr:1
16endif
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +010017
D. Ben Knoble5eb9cb52023-12-16 08:24:15 -050018setlocal lispwords+=module,module*,module+,parameterize,parameterize*,let-values,let*-values,letrec-values,local
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +010019setlocal lispwords+=define/contract
20setlocal lispwords+=λ
21setlocal lispwords+=with-handlers
22setlocal lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse
23setlocal lispwords+=define-for-syntax,define-syntax-parser,define-syntax-parse-rule,define-syntax-class,define-splicing-syntax-class
D. Ben Knoble8e013b12024-11-13 19:45:38 +010024setlocal lispwords+=syntax/loc,quasisyntax/loc
D. Ben Knoble5eb9cb52023-12-16 08:24:15 -050025setlocal lispwords+=define-syntax-parameter,syntax-parameterize
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +010026setlocal lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig
27setlocal lispwords+=define-opt/c,define-syntax-rule
D. Ben Knoble5eb9cb52023-12-16 08:24:15 -050028setlocal lispwords+=define-test-suite,test-case
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +010029setlocal lispwords+=struct
30setlocal lispwords+=with-input-from-file,with-output-to-file
D. Ben Knoble5eb9cb52023-12-16 08:24:15 -050031setlocal lispwords+=begin,begin0
32setlocal lispwords+=place
33setlocal lispwords+=cond
D. Ben Knoble8e013b12024-11-13 19:45:38 +010034" Racket style indents if like a function application:
35" (if test
36" then
37" else)
38setlocal lispwords-=if
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +010039
40" Racket OOP
41" TODO missing a lot of define-like forms here (e.g., define/augment, etc.)
42setlocal lispwords+=class,class*,mixin,interface,class/derived
43setlocal lispwords+=define/public,define/pubment,define/public-final
44setlocal lispwords+=define/override,define/overment,define/override-final
45setlocal lispwords+=define/augment,define/augride,define/augment-final
46setlocal lispwords+=define/private
47
48" kanren
49setlocal lispwords+=fresh,run,run*,project,conde,condu
50
51" loops
52setlocal lispwords+=for,for/list,for/fold,for*,for*/list,for*/fold,for/or,for/and,for*/or,for*/and
53setlocal 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
54setlocal lispwords+=for/async
55setlocal lispwords+=for/set,for*/set
56setlocal lispwords+=for/first,for*/first
D. Ben Knoble5eb9cb52023-12-16 08:24:15 -050057setlocal lispwords+=for/last,for*/last
58setlocal lispwords+=for/stream,for*/stream
D. Ben Knoble8e013b12024-11-13 19:45:38 +010059setlocal lispwords+=for/lists,for*/lists
Bram Moolenaar9b03d3e2022-08-30 20:26:34 +010060
61setlocal lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda**
62setlocal lispwords+=match-let,match-let*,match-let-values,match-let*-values
63setlocal lispwords+=match-letrec,match-define,match-define-values
64
65setlocal lispwords+=let/cc,let/ec
66
67" qi
68setlocal lispwords+=define-flow,define-switch,flow-lambda,switch-lambda,on,switch,π,λ01
69setlocal lispwords+=define-qi-syntax,define-qi-syntax-parser,define-qi-syntax-rule
70
71" gui-easy
72setlocal lispwords+=if-view,case-view,cond-view,list-view,dyn-view
73setlocal lispwords+=case/dep
74setlocal lispwords+=define/obs
75
D. Ben Knoble8e013b12024-11-13 19:45:38 +010076" rackunit
77setlocal lispwords+=define-simple-check,define-binary-check,define-check,with-check-info
78
D. Ben Knoble83f627f2024-01-31 14:53:55 -050079let b:undo_indent = "setlocal lisp< ai< si< lw<" .. (has('vim9script') ? ' indentexpr< lispoptions<' : '')