diff --git a/ftplugin/racket.vim b/ftplugin/racket.vim index 551084d..f44cbb4 100644 --- a/ftplugin/racket.vim +++ b/ftplugin/racket.vim @@ -41,7 +41,8 @@ setl makeprg=raco\ make\ --\ % " "press ENTER or type a command to continue" " We avoid the annoyance of having to hit enter by remapping K directly. nnoremap RacketDoc :silent !raco docs :redraw! -if maparg("K", "n") == "" +let b:nmapped_K = maparg("K", "n") == "" +if b:nmapped_K nmap K RacketDoc endif @@ -60,7 +61,8 @@ function! s:Racket_visual_doc() endfunction vnoremap RacketDoc :call Racket_visual_doc() -if maparg("K", "v") == "" +let b:vmapped_K = maparg("K", "v") == "" +if b:vmapped_K vmap K RacketDoc endif @@ -77,6 +79,6 @@ endif let b:undo_ftplugin = \ "setl iskeyword< lispwords< lisp< comments< formatoptions<" \. "| setl makeprg< commentstring<" - \. "| nunmap K" - \. "| vunmap K" + \. (b:nmapped_K ? "| nunmap K" : "") + \. (b:vmapped_K ? "| vunmap K" : "") \. "| unlet! b:browsefilter"