From abca7c20144a1aa0c0197e17cacd892e3ff99ff2 Mon Sep 17 00:00:00 2001 From: Adam Stankiewicz Date: Thu, 25 Jun 2020 13:38:07 +0200 Subject: Update --- ftplugin/racket.vim | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'ftplugin/racket.vim') diff --git a/ftplugin/racket.vim b/ftplugin/racket.vim index 89990061..1a3ba189 100644 --- a/ftplugin/racket.vim +++ b/ftplugin/racket.vim @@ -4,6 +4,11 @@ if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'racket') == -1 " Maintainer: Will Langstroth " URL: http://github.com/wlangstroth/vim-racket +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + 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 @@ -37,7 +42,10 @@ setl makeprg=raco\ make\ --\ % " 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! +nnoremap RacketDoc :silent !raco docs :redraw! +if maparg("K", "n") == "" + nmap K RacketDoc +endif " For the visual mode K mapping, it's slightly more convoluted to get the " selected text: @@ -53,9 +61,20 @@ function! s:Racket_visual_doc() endtry endfunction -vnoremap K :call Racket_visual_doc() +vnoremap RacketDoc :call Racket_visual_doc() +if maparg("K", "v") == "" + vmap K RacketDoc +endif "setl commentstring=;;%s setl commentstring=#\|\ %s\ \|# +" Undo our settings when the filetype changes away from Racket +" (this should be amended if settings/mappings are added above!) +let b:undo_ftplugin = + \ "setl iskeyword< lispwords< lisp< comments< formatoptions<" + \. "| setl makeprg< commentstring<" + \. "| nunmap K" + \. "| vunmap K" + endif -- cgit v1.2.3