Created
August 3, 2013 01:47
-
-
Save guns/6144732 to your computer and use it in GitHub Desktop.
Example function and mapping for running slamhound on the current file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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