wlangstroth/vim-racket

Add Vim commands for running/building

jcmdln opened this issue · 0 comments

One feature that was pretty handy in fatih/vim-go was the ability to use shorthand's such as :GoBuild, and I've been playing around with doing this for Racket:

command! -nargs=* RktDocs :silent execute "!raco docs" '<args>' | redraw!
command! RktExe  execute "!raco exe -v %"
command! RktREPL execute "!racket -il xrepl"
command! RktMake execute "!raco make -j $(grep -c ^processor /proc/cpuinfo) -v %"
command! RktRun  execute "!racket %"

I suppose this really doesn't shorten the total number of characters someone would need to type all that much, though personally I find this more convenient than using :!racket -il xrepl directly. Any chance of something like this being added to ftplugin/racket.vim?

Edit: Updated :RktMake to count the total CPU cores, and it might be the best use-case for these shorthand's I've presented.

Edit2: Additionally, I've added a dirty method of using raco docs <desired search term> to lookup a command:

command! -nargs=* RktDocs :silent execute "!raco docs" '<args>' | redraw!

The built-in method of using K seems to only work with racket man pages being installed globally and gives me an error stating 'No manual entry for racket' with racket installed to ~/, might be worth reviewing.