Skip to content

Instantly share code, notes, and snippets.

@guns
Created August 3, 2013 01:47
Show Gist options
  • Save guns/6144732 to your computer and use it in GitHub Desktop.
Save guns/6144732 to your computer and use it in GitHub Desktop.
Example function and mapping for running slamhound on the current file
" Require fireplace.vim
function! s:ClojureSlamHound(file)
if &modified
echom "Buffer contains unsaved changes!"
return 1
endif
call fireplace#session_eval(
\ '(clojure.core/require (quote slam.hound) (quote clojure.pprint))'
\ . '(let [file (clojure.java.io/file "' . a:file . '")]'
\ . ' (binding [clojure.pprint/*print-right-margin* ' . &textwidth . ']'
\ . ' (slam.hound/swap-in-reconstructed-ns-form file)))'
\ )
edit
endfunction
" In after/clojure.vim or in an autocommand:
nnoremap <silent><buffer> <LocalLeader>sh :call <SID>ClojureSlamHound(expand('%'))<CR>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment