Well, you could use the racket-mode from emacs to indent your files. You will need to install GNU Emacs and racket-mode, and save the following in indent-racket-file.sh:
#!/bin/bash
FILE=$1
emacs --daemon --eval "
(progn
(find-file \"$1\")
(racket-mode)
(indent-region (point-min) (point-max))
(save-buffer (current-buffer))
(kill-buffer (current-buffer))
(setq confirm-kill-processes nil)
(save-buffers-kill-terminal))"
You will than be able to indent racket files from the terminal by calling (and presumably you can setup vim to call this script).
indent-racket-file.sh some-file.rkt
This script will indent the file in place but you could write the file to a temporary one and indent that. You could also update the shell script to read from stdin, save to a temporary file, load it in Emacs and indent it than pipe it out -- this would make the script work as a pipe, but it will not be very efficient.
Also, if Emacs startup is slow, you can write an indent helper function in elisp:
;; save to racket-indent-helper.el
(defun indent-racket-file (name)
(find-file name)
(racket-mode)
(indent-region (point-min) (point-max))
(save-buffer (current-buffer))
(kill-buffer (current-buffer)))
and start emacs as a background process:
emacs --daemon --load racket-indent-helper.el
You can than update the shell script to be:
#!/bin/bash
FILE=$1
emacsclient --eval "(indent-racket-file \"$1\")"
Alex.