Personally, I still fall back to plain-old console/println debugging output more often then I’d like. Especially when I’m a bit lukewarm, although in those cases, I tend to use browser based JS, perhaps even the Try Wisp browser editor which instantly compiles to JavaScript (unless you screw up) and helps to get the mind acquainted to the situation and syntax.
While venturing deeper in the language however, you’ll find that for example macro’s cannot be dealt with in the Try Wisp online editor/compiler and one has to move to the local machine instead to experiment further. The REPL, by the way, really isn’t half as useful as it can (and perhaps should) be although some steps have been made to improve on this.
Since I work over SSH quite often, also in hot remote development/test tweaking, I almost always use vim.
One or two of the things I’ve setup in my custom ~/.vimrc run-command file, actually are enhanced by a few
other system utilities and tweaks as well, which I’ve mentioned below:
-
edit your
~/.zshrcor~/.bashrcfile and addstty -ixonto the foot of the file (Allow for e.g. vim to usectrl-sto save) -
download
pythonand usepipto installpygmentize
Now to ~/.vimrc I’ve added:
" File types
BufRead,BufNewFile *.wisp set filetype=clojure
au BufRead,BufNewFile *.edn set filetype=clojure
" Command runner
au BufEnter * if match( getline(1) , '^\#!') == 0 |
\ execute("let b:interpreter = getline(1)[2:]") |
\endif
" F5 run wisp code in Node.js and executes effects in running process
fun! CallInterpreter()
if exists("b:interpreter")
exec ("!".b:interpreter." %")
endif
endfun
map <F5> :call CallInterpreter()<CR>
" F6 compiles Wisp code to JavaScript and displays result in terminal ANSI color
fun! CallCompiler()
if exists("b:interpreter")
exec ("!".b:interpreter." -c --no-map % | pygmentize -l javascript")
endif
endfun
map <F6> :call CallCompiler()<CR>
Don’t forget to make your wisp source files (I conventionally place them in src/ directory) as executable
using (in Vim) !chmod +x % and via terminal chmod +x <filename>. In the case of vim, to catch up on the
shebang, a close and reopen of the file may occasionally be needed. The shebang itself would be a typical wisp
executable !#/usr/local/bin wisp (one which I’ve patched and recompiled, more later).