- GVim
- tmux (for vim-dispatch)
- Clojure
- Leiningen 2
- drip (https://github.com/flatland/drip)
- vim-clojure-static
- vim-fireplace
- vim-classpath
- vim-dispatch
- ConqueTerm
First of all, Fireplace gives you <C-W> <C-D
> - open symbol definition under cursor in a split. Haven't figured out how to make it work for Java methods and classes, though.
Custom functions I defined using ConqueTerm:
:Repl
Launch a Lein REPL:Clj
Evaluate arbitrary Clojure code in the current buffer.
Source:
let s:CLOJURE_JAR = $HOME."/java/clojure-1.5.1/clojure-1.5.1.jar"
fun! CljCMD()
execute 'w! /tmp/temp.clj'
execute 'set syntax=clojure'
execute 'ConqueTermSplit drip -cp '.s:CLOJURE_JAR.' clojure.main /tmp/temp.clj'
endf
command! Clj call CljCMD()
fun! LeinCMD()
execute 'ConqueTermSplit lein repl'
execute 'set syntax=clojure'
execute 'normal! i'
endf
command! Repl call LeinCMD()
(Adapted from: http://stackoverflow.com/q/15734470/7507)
Now, if just want to test out some Clojure code, just create a new buffer with some code and run :Clj
. If you want a full REPL, use :Repl
. Since you are using drip, these commands (especially :Clj
) will execute rather quickly the second time you run them.
Note that to exit either, you may need to <Ctrl-D>
while in insert mode or kill the spawned Java process. Closing the buffer with :bd
does not automatically kill the process.
Also notice that :Clj
doesn't launch a REPL. It evaluates Clojure code. So you won't see any output unless your code actually has (println)
or similar output.
I also tried to get Clojure evaluation working with vim-pipe, but couldn't get it to work:
autocmd FileType clj let b:vimpipe_command="drip -cp ".s:CLOJURE_JAR." clojure.main /tmp/temp.clj"
autocmd FileType clj let b:vimpipe_filetype="clojure"
That's because Pipe expects to read the contents of the buffer as if from stdin, as do python
and ruby
. But clojure.main
takes either command line, script or launches a repl - so I went the ConqueTerm route.
Dispatch allows you to launch a long-running process, such as a Leiningen build, in the background and capture the output. View the trailer.
If you launch gvim from tmux, :Make
(note uppercase M
) will now run lein <build target>
on your tmux command line and redirect the result to Copen
. It's like magic.
Steps:
tmux
gvim project.clj
(In gvim)
:Make test
Other plugins that I installed but haven't internalized yet.
- surround
- vim-paredit