From d5b9c4ae84aaa98bdfbf15cba90eeafa5aded091 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Wed, 17 May 2017 11:46:19 +0200 Subject: Add racket support, #159 --- ftplugin/racket.vim | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 ftplugin/racket.vim (limited to 'ftplugin/racket.vim') diff --git a/ftplugin/racket.vim b/ftplugin/racket.vim new file mode 100644 index 00000000..14ebdb7c --- /dev/null +++ b/ftplugin/racket.vim @@ -0,0 +1,63 @@ +if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1 + +" Language: Racket +" Maintainer: Will Langstroth +" URL: http://github.com/wlangstroth/vim-racket + +setl iskeyword+=#,%,^ +setl lispwords+=module,module*,module+,parameterize,let-values,let*-values,letrec-values,local +setl lispwords+=define-values,opt-lambda,case-lambda,syntax-rules,with-syntax,syntax-case,syntax-parse +setl lispwords+=define-signature,unit,unit/sig,compund-unit/sig,define-values/invoke-unit/sig +setl lispwords+=define-opt/c,define-syntax-rule +setl lispwords+=struct + +" Racket OOP +setl lispwords+=class,define/public,define/private + +" kanren +setl lispwords+=fresh,run,run*,project,conde,condu + +" loops +setl lispwords+=for,for/list,for/fold,for*,for*/list,for*/fold,for/or,for/and +setl lispwords+=for/hash,for/sum,for/flvector,for*/flvector,for/vector + +setl lispwords+=match,match*,match/values,define/match,match-lambda,match-lambda*,match-lambda** +setl lispwords+=match-let,match-let*,match-let-values,match-let*-values +setl lispwords+=match-letrec,match-define,match-define-values +setl lisp + +" Enable auto begin new comment line when continuing from an old comment line +setl comments+=:; +setl formatoptions+=r + +setl makeprg=raco\ make\ --\ % + +" Simply setting keywordprg like this works: +" setl keywordprg=raco\ docs +" but then vim says: +" "press ENTER or type a command to continue" +" We avoid the annoyance of having to hit enter by remapping K directly. +nnoremap K :silent !raco docs :redraw! + +" For the visual mode K mapping, it's slightly more convoluted to get the +" selected text: +function! s:Racket_visual_doc() + try + let l:old_a = @a + normal! gv"ay + call system("raco docs '". @a . "'") + redraw! + return @a + finally + let @a = l:old_a + endtry +endfunction + +vnoremap K :call Racket_visual_doc() + +nnoremap :!racket -t % + +"setl commentstring=;;%s +setl commentstring=#\|\ %s\ \|# + +endif -- cgit v1.2.3