I'd like to pitch in here as I think it's distressing to see (vim
familiar) people abandoning clojure when it's quite possible to have
an easy and very efficient working environment using just vim,
vimclojure and rlwrap. I set this up 14 months ago when I started with
clojure and I'd be dragged kicking and screaming to have to use
anything else.

Just to describe what I'm seeing in front of me on a 15" laptop and a
32" external screen as I type;
- Three instances of MacVim, each with about 6 to 12 tabs open with
various clojure and other files.
- Two instances of Terminal, each with about 8 console tabs in various
directories on my local machine and also various ssh sessions on a few
remote servers.
- One instance of Netbeans with about 10 tabs of various java, html,
jsp (yes, I still have to do legacy Jsp stuff), javascript, etc. I
don't use Enclojure on Netbeans as I've just not got around to trying
it. So all my clojure work is done in vim/rlwrap.
- All the other cruft one normally has, e.g (Mail, a few instances of
Firefox, etc).

So, what is a typical sequence of "events"?
- Option-tab to a particular MacVim instance
- gT to get to a particular tab, or maybe :tabe to open a new file in a tab
- Make a change, :w to save
- Option-tab to a Terminal instance
- Option-shift-right-arrow to a particular terminal tab running the
Repl in rlwrap
- type "(use" and press up arrow to get last "(use 'some-ns.some-fn :reload)"
- press Enter to execute. Dabble in the Repl. Use mouse to select from
console, copy and paste into MacVim
- Option-tab to Terminal/ bash session, up-arrow, run previous scp to
copy stuff to server
- Option-tab to Terminal/ssh session running vim on server, quick
change to script, :w
- Option-tab to Terminal/ssh session running repl, recall last clojure
"(use", etc, etc
All in the spirit of a good ole unix hacker who eschews the use of the mouse :).

I'll describe my setup so hopefully others can be similarly
"empowered". Generally I work on a MacBook Pro OS/X 10.5 with JDK 1.6,
but I also run the same clojure setup on a number of servers running
either Arch Linux or Ubuntu. These I access through ssh terminal
sessions. On the Mac I have MacVim installed (as it has great mouse
support (my mouse sentiment notwithstanding) and handles Mac-like
copy, paste, etc), and on the Linuxes, just vim 7.2. I only installed
the vimclojure syntax and indent plugins, but I haven't used the rest.
Rlwrap is installed through Mac-ports and the package managers on
Arch/Ubuntu. Rlwrap allows you to wrap a terminal/console session and
use really great history recall and line-editing features. Now for the
setup part;

Firstly,  the following .inputrc on the mac...
cat ~/.inputrc...
"\e[A": history-search-backward
"\e[B": history-search-forward
set completion-ignore-case on
set show-all-if-ambiguous on
$if Bash
  Space: magic-space
$endif

and in /etc/inputrc on linux, the following two lines added...
"\e[5~": history-search-backward
"\e[6~": history-search-forward

The above allows you to use the up/dn, pgup,pgdn keys to do partial
command line history recall. If you have that, you don't need any
other history recall features. You can then type just the first few
characters of a command, press the up arrow and cycle through all
previous command entries starting with those characters. Of course you
still have all the other command line editing capabilities provided by
readline, e.g, ctrl-e, ctrl-a, ctrl-r, etc.

Java setup; I have a ~/Downloads directory for all downloaded pakages,
libraries, etc. Different versions all go in the same directory, but
under their own sub-tree. E.g
~/Downloads/Apache/lucene-2.9.0/...
~/Downloads/Apache/lucene-3.0.0/...
~/Downloads/Clojure/clojure_1.0.0/...
and so on. Then I have a root directory /jx in which I create symbolic
links for different logical (at least to me) sets of jars from the
above downloads, eg:
ls -l /jx/cl
... clojure-contrib.jar ->
/Users/adrian/Downloads/Clojure/clojure-contrib/clojure-contrib.jar
... clojure.jar ->
/Users/adrian/Downloads/Clojure/clojure/clojure-1.1.0-master-SNAPSHOT.jar
ls -l /jx/luc
... lucene-analyzers.jar ->
/Users/adrian/Downloads/apache/lucene-3.0.0/contrib/analyzers/common/lucene-analyzers-3.0.0.jar
... lucene-core.jar ->
/Users/adrian/Downloads/apache/lucene-3.0.0/lucene-core-3.0.0.jar
(I maintain the links with a single bash script).

For running the repl, I use simple bash scripts in each working
directory where I have clojure projects/source;
#!/bin/bash
source /Users/adrian/bin/dirj.sh
dirj /jx/cl
dirj /jx/jty/lib/
dirj /jx/luc
EXTRAS=/jx/misc/quartz.jar:/jx/misc/commons-logging.jar
CP=./:./classes:$EXTRAS:$CP
OPTS='-Dorg.mortbay.util.FileResource.checkAliases=false -Xms32M
-Xmx512M -server'
echo $CP
exec rlwrap java $OPTS -cp $CP clojure.main $1 $2 $3 $4 $5 $6 $7 $8 $9

You'll notice the above uses dirj.sh which is a little script that
"sucks" in all the jars in a particular directory.
This (at least the idea) is courtesy of either Stuart Sierra, or
Chouser (own up if it was someone else);
#!/bin/bash
dirj() {
    CP=$CP$(find $1 -depth 1 -name *.jar -exec printf :{} ';')
}

Summary: The above is quite a simple setup for a unixy person and can
really go a long way. I don't think my development processes have ever
been quite as efficient as they are now. Sorry I don't have a solution
for the Windowsy people - oh wait - there's cygwin!

Rgds, Adrian

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to