Commits

Scott Scites  committed ee64fcb

Add vim clojure and paredit

  • Participants
  • Parent commits ca95b7d

Comments (0)

Files changed (35)

File .vim/autoload/vimclojure.vim

+" Part of Vim filetype plugin for Clojure
+" Language:     Clojure
+" Maintainer:   Meikel Brandmeyer <mb@kotka.de>
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! vimclojure#WarnDeprecated(old, new)
+	echohl WarningMsg
+	echomsg a:old . " is deprecated! Use " . a:new . "!"
+	echomsg "eg. let " . a:new . " = <desired value here>"
+	echohl None
+endfunction
+
+" Configuration
+if !exists("g:vimclojure#FuzzyIndent")
+	let vimclojure#FuzzyIndent = 0
+endif
+
+if !exists("g:vimclojure#HighlightBuiltins")
+	if exists("g:clj_highlight_builtins")
+		call vimclojure#WarnDeprecated("g:clj_highlight_builtins",
+					\ "vimclojure#HighlightBuiltins")
+		let vimclojure#HighlightBuiltins = g:clj_highlight_builtins
+	else
+		let vimclojure#HighlightBuiltins = 1
+	endif
+endif
+
+if exists("g:clj_highlight_contrib")
+	echohl WarningMsg
+	echomsg "clj_highlight_contrib is deprecated! It's removed without replacement!"
+	echohl None
+endif
+
+if !exists("g:vimclojure#DynamicHighlighting")
+	if exists("g:clj_dynamic_highlighting")
+		call vimclojure#WarnDeprecated("g:clj_dynamic_highlighting",
+					\ "vimclojure#DynamicHighlighting")
+		let vimclojure#DynamicHighlighting = g:clj_dynamic_highlighting
+	else
+		let vimclojure#DynamicHighlighting = 0
+	endif
+endif
+
+if !exists("g:vimclojure#ParenRainbow")
+	if exists("g:clj_paren_rainbow")
+		call vimclojure#WarnDeprecated("g:clj_paren_rainbow",
+					\ "vimclojure#ParenRainbow")
+		let vimclojure#ParenRainbow = g:clj_paren_rainbow
+	else
+		let vimclojure#ParenRainbow = 0
+	endif
+endif
+
+if !exists("g:vimclojure#WantNailgun")
+	if exists("g:clj_want_gorilla")
+		call vimclojure#WarnDeprecated("g:clj_want_gorilla",
+					\ "vimclojure#WantNailgun")
+		let vimclojure#WantNailgun = g:clj_want_gorilla
+	else
+		let vimclojure#WantNailgun = 0
+	endif
+endif
+
+if !exists("g:vimclojure#NailgunServer")
+	let vimclojure#NailgunServer = "127.0.0.1"
+endif
+
+if !exists("g:vimclojure#NailgunPort")
+	let vimclojure#NailgunPort = "2113"
+endif
+
+if !exists("g:vimclojure#UseErrorBuffer")
+	let vimclojure#UseErrorBuffer = 1
+endif
+
+if !exists("g:vimclojure#SetupKeyMap")
+	let vimclojure#SetupKeyMap = 1
+endif
+
+function! vimclojure#ReportError(msg)
+	if g:vimclojure#UseErrorBuffer
+		let buf = g:vimclojure#ResultBuffer.New()
+		call buf.showText(a:msg)
+		wincmd p
+	else
+		echoerr substitute(a:msg, '\n\(\t\?\)', ' ', 'g')
+	endif
+endfunction
+
+function! vimclojure#EscapePathForOption(path)
+	let path = fnameescape(a:path)
+
+	" Hardcore escapeing of whitespace...
+	let path = substitute(path, '\', '\\\\', 'g')
+	let path = substitute(path, '\ ', '\\ ', 'g')
+
+	return path
+endfunction
+
+function! vimclojure#AddPathToOption(path, option)
+	let path = vimclojure#EscapePathForOption(a:path)
+	execute "setlocal " . a:option . "+=" . path
+endfunction
+
+function! vimclojure#AddCompletions(ns)
+	let completions = split(globpath(&rtp, "ftplugin/clojure/completions-" . a:ns . ".txt"), '\n')
+	if completions != []
+		call vimclojure#AddPathToOption('k' . completions[0], 'complete')
+	endif
+endfunction
+
+function! ClojureExtractSexprWorker() dict
+	let pos = [0, 0]
+	let start = getpos(".")
+
+	if getline(start[1])[start[2] - 1] == "("
+				\ && vimclojure#util#SynIdName() =~ 'clojureParen' . self.level
+		let pos = [start[1], start[2]]
+	endif
+
+	if pos == [0, 0]
+		let pos = searchpairpos('(', '', ')', 'bW' . self.flag,
+					\ 'vimclojure#util#SynIdName() !~ "clojureParen\\d"')
+	endif
+
+	if pos == [0, 0]
+		throw "Error: Not in a s-expression!"
+	endif
+
+	return [pos, vimclojure#util#Yank('l', 'normal! "ly%')]
+endfunction
+
+" Nailgun part:
+function! vimclojure#ExtractSexpr(toplevel)
+	let closure = {
+				\ "flag"  : (a:toplevel ? "r" : ""),
+				\ "level" : (a:toplevel ? "0" : '\d'),
+				\ "f"     : function("ClojureExtractSexprWorker")
+				\ }
+
+	return vimclojure#util#WithSavedPosition(closure)
+endfunction
+
+function! vimclojure#BufferName()
+	let file = expand("%")
+	if file == ""
+		let file = "UNNAMED"
+	endif
+	return file
+endfunction
+
+" Key mappings and Plugs
+function! vimclojure#MakePlug(mode, plug, f, args)
+	if a:mode == "i"
+		let esc = "<ESC>"
+	else
+		let esc = ""
+	endif
+
+	execute a:mode . "noremap <Plug>Clojure" . a:plug
+				\ . " " . esc . ":call " . a:f . "(" . a:args . ")<CR>"
+endfunction
+
+function! vimclojure#MakeProtectedPlug(mode, plug, f, args)
+	execute a:mode . "noremap <Plug>Clojure" . a:plug
+				\ . " :call vimclojure#ProtectedPlug(function(\""
+				\ . a:f . "\"), [ " . a:args . " ])<CR>"
+endfunction
+
+function! vimclojure#MakeCommandPlug(mode, plug, f, args)
+	execute a:mode . "noremap <Plug>Clojure" . a:plug
+				\ . " :call vimclojure#ProtectedPlug("
+				\ . " function(\"vimclojure#CommandPlug\"),"
+				\ . " [ function(\"" . a:f . "\"), [ " . a:args . " ]])<CR>"
+endfunction
+
+function! vimclojure#MapPlug(mode, keys, plug)
+	if exists("g:vimclojure#SetupKeyMap" . a:plug)
+		execute "let doSetup = g:vimclojure#SetupKeyMap" . a:plug
+	else
+		let doSetup = g:vimclojure#SetupKeyMap
+	endif
+
+	if doSetup && !hasmapto("<Plug>Clojure" . a:plug, a:mode)
+		execute a:mode . "map <buffer> <unique> <silent> <LocalLeader>" . a:keys
+					\ . " <Plug>Clojure" . a:plug
+	endif
+endfunction
+
+if !exists("*vimclojure#CommandPlug")
+	function vimclojure#CommandPlug(f, args)
+		if exists("b:vimclojure_loaded")
+					\ && !exists("b:vimclojure_namespace")
+					\ && g:vimclojure#WantNailgun == 1
+			unlet b:vimclojure_loaded
+			call vimclojure#InitBuffer("silent")
+		endif
+
+		if exists("b:vimclojure_namespace")
+			call call(a:f, a:args)
+		elseif g:vimclojure#WantNailgun == 1
+			let msg = "VimClojure could not initialise the server connection.\n"
+						\ . "That means you will not be able to use the interactive features.\n"
+						\ . "Reasons might be that the server is not running or that there is\n"
+						\ . "some trouble with the classpath.\n\n"
+						\ . "VimClojure will *not* start the server for you or handle the classpath.\n"
+						\ . "There is a plethora of tools like ivy, maven, gradle and leiningen,\n"
+						\ . "which do this better than VimClojure could ever do it."
+			throw msg
+		endif
+	endfunction
+endif
+
+if !exists("*vimclojure#ProtectedPlug")
+	function vimclojure#ProtectedPlug(f, args)
+		try
+			return call(a:f, a:args)
+		catch /.*/
+			call vimclojure#ReportError(v:exception)
+		endtry
+	endfunction
+endif
+
+" A Buffer...
+if !exists("g:vimclojure#SplitPos")
+	let vimclojure#SplitPos = "top"
+endif
+
+if !exists("g:vimclojure#SplitSize")
+	let vimclojure#SplitSize = ""
+endif
+
+let vimclojure#Object = {}
+
+function! vimclojure#Object.New(...) dict
+	let instance = copy(self)
+	let instance.prototype = self
+
+	call call(instance.Init, a:000, instance)
+
+	return instance
+endfunction
+
+function! vimclojure#Object.Init() dict
+endfunction
+
+let vimclojure#Buffer = copy(vimclojure#Object)
+let vimclojure#Buffer["__superObjectNew"] = vimclojure#Buffer["New"]
+
+function! vimclojure#Buffer.New(...) dict
+	if g:vimclojure#SplitPos == "left" || g:vimclojure#SplitPos == "right"
+		let o_sr = &splitright
+		if g:vimclojure#SplitPos == "left"
+			set nosplitright
+		else
+			set splitright
+		end
+		execute printf("%svnew", g:vimclojure#SplitSize)
+		let &splitright = o_sr
+	else
+		let o_sb = &splitbelow
+		if g:vimclojure#SplitPos == "bottom"
+			set splitbelow
+		else
+			set nosplitbelow
+		end
+		execute printf("%snew", g:vimclojure#SplitSize)
+		let &splitbelow = o_sb
+	endif
+
+	return call(self.__superObjectNew, a:000, self)
+endfunction
+
+function! vimclojure#Buffer.Init() dict
+	let self._buffer = bufnr("%")
+endfunction
+
+function! vimclojure#Buffer.goHere() dict
+	execute "buffer! " . self._buffer
+endfunction
+
+function! vimclojure#Buffer.goHereWindow() dict
+	execute "sbuffer! " . self._buffer
+endfunction
+
+function! vimclojure#Buffer.resize() dict
+	call self.goHere()
+	let size = line("$")
+	if size < 3
+		let size = 3
+	endif
+	execute "resize " . size
+endfunction
+
+function! vimclojure#Buffer.showText(text) dict
+	call self.goHere()
+	if type(a:text) == type("")
+		" XXX: Opening the box of the pandora.
+		" 2012-01-09: Adding Carriage Returns here.
+		let text = split(a:text, '\r\?\n')
+	else
+		let text = a:text
+	endif
+	call append(line("$"), text)
+endfunction
+
+function! vimclojure#Buffer.showOutput(output) dict
+	call self.goHere()
+	if a:output.value == 0
+		if a:output.stdout != ""
+			call self.showText(a:output.stdout)
+		endif
+		if a:output.stderr != ""
+			call self.showText(a:output.stderr)
+		endif
+	else
+		call self.showText(a:output.value)
+	endif
+endfunction
+
+function! vimclojure#Buffer.clear() dict
+	1
+	normal! "_dG
+endfunction
+
+function! vimclojure#Buffer.close() dict
+	execute "bdelete! " . self._buffer
+endfunction
+
+" The transient buffer, used to display results.
+let vimclojure#ResultBuffer = copy(vimclojure#Buffer)
+let vimclojure#ResultBuffer["__superBufferNew"] = vimclojure#ResultBuffer["New"]
+let vimclojure#ResultBuffer["__superBufferInit"] = vimclojure#ResultBuffer["Init"]
+let vimclojure#ResultBuffer.__instance = []
+
+function! ClojureResultBufferNewWorker() dict
+	set switchbuf=useopen
+	call self.instance.goHereWindow()
+	call call(self.instance.Init, self.args, self.instance)
+
+	return self.instance
+endfunction
+
+function! vimclojure#ResultBuffer.New(...) dict
+	if g:vimclojure#ResultBuffer.__instance != []
+		let oldInstance = g:vimclojure#ResultBuffer.__instance[0]
+
+		if oldInstance.prototype is self
+			let closure = {
+						\ 'instance' : oldInstance,
+						\ 'args'     : a:000,
+						\ 'f'        : function("ClojureResultBufferNewWorker")
+						\ }
+
+			return vimclojure#util#WithSavedOption('switchbuf', closure)
+		else
+			call oldInstance.close()
+		endif
+	endif
+
+	let b:vimclojure_result_buffer = 1
+	let instance = call(self.__superBufferNew, a:000, self)
+	let g:vimclojure#ResultBuffer.__instance = [ instance ]
+
+	return instance
+endfunction
+
+function! vimclojure#ResultBuffer.Init() dict
+	call self.__superBufferInit()
+
+	setlocal noswapfile
+	setlocal buftype=nofile
+	setlocal bufhidden=wipe
+
+	call vimclojure#MapPlug("n", "p", "CloseResultBuffer")
+
+	call self.clear()
+	let leader = exists("g:maplocalleader") ? g:maplocalleader : "\\"
+	call append(0, "; Use " . leader . "p to close this buffer!")
+endfunction
+
+function! vimclojure#ResultBuffer.CloseBuffer() dict
+	if g:vimclojure#ResultBuffer.__instance != []
+		let instance = g:vimclojure#ResultBuffer.__instance[0]
+		let g:vimclojure#ResultBuffer.__instance = []
+		call instance.close()
+	endif
+endfunction
+
+function! s:InvalidateResultBufferIfNecessary(buf)
+	if g:vimclojure#ResultBuffer.__instance != []
+				\ && g:vimclojure#ResultBuffer.__instance[0]._buffer == a:buf
+		let g:vimclojure#ResultBuffer.__instance = []
+	endif
+endfunction
+
+augroup VimClojureResultBuffer
+	au BufDelete * call s:InvalidateResultBufferIfNecessary(expand("<abuf>"))
+augroup END
+
+" A special result buffer for clojure output.
+let vimclojure#ClojureResultBuffer = copy(vimclojure#ResultBuffer)
+let vimclojure#ClojureResultBuffer["__superResultBufferInit"] =
+			\ vimclojure#ResultBuffer["Init"]
+let vimclojure#ClojureResultBuffer["__superResultBufferShowOutput"] =
+			\ vimclojure#ResultBuffer["showOutput"]
+
+function! vimclojure#ClojureResultBuffer.Init(ns) dict
+	call self.__superResultBufferInit()
+	set filetype=clojure
+	let b:vimclojure_namespace = a:ns
+endfunction
+
+function! vimclojure#ClojureResultBuffer.showOutput(text) dict
+	call self.__superResultBufferShowOutput(a:text)
+	normal G
+endfunction
+
+" Nails
+if !exists("vimclojure#NailgunClient")
+	let vimclojure#NailgunClient = "ng"
+endif
+
+function! ClojureShellEscapeArgumentsWorker() dict
+	set noshellslash
+	return map(copy(self.vals), 'shellescape(v:val)')
+endfunction
+
+function! vimclojure#ShellEscapeArguments(vals)
+	let closure = {
+				\ 'vals': a:vals,
+				\ 'f'   : function("ClojureShellEscapeArgumentsWorker")
+				\ }
+
+	return vimclojure#util#WithSavedOption('shellslash', closure)
+endfunction
+
+function! vimclojure#ExecuteNailWithInput(nail, input, ...)
+	if type(a:input) == type("")
+		let input = split(a:input, '\n', 1)
+	else
+		let input = a:input
+	endif
+
+	let inputfile = tempname()
+	try
+		call writefile(input, inputfile)
+
+		let cmdline = vimclojure#ShellEscapeArguments(
+					\ [g:vimclojure#NailgunClient,
+					\   '--nailgun-server', g:vimclojure#NailgunServer,
+					\   '--nailgun-port', g:vimclojure#NailgunPort,
+					\   'vimclojure.Nail', a:nail]
+					\ + a:000)
+		let cmd = join(cmdline, " ") . " <" . inputfile
+		" Add hardcore quoting for Windows
+		if has("win32") || has("win64")
+			let cmd = '"' . cmd . '"'
+		endif
+
+		let output = system(cmd)
+
+		if v:shell_error
+			throw "Error executing Nail! (" . v:shell_error . ")\n" . output
+		endif
+	finally
+		call delete(inputfile)
+	endtry
+
+	execute "let result = " . substitute(output, '\n$', '', '')
+	return result
+endfunction
+
+function! vimclojure#ExecuteNail(nail, ...)
+	return call(function("vimclojure#ExecuteNailWithInput"), [a:nail, ""] + a:000)
+endfunction
+
+function! vimclojure#DocLookup(word)
+	if a:word == ""
+		return
+	endif
+
+	let doc = vimclojure#ExecuteNailWithInput("DocLookup", a:word,
+				\ "-n", b:vimclojure_namespace)
+	let buf = g:vimclojure#ResultBuffer.New()
+	call buf.showOutput(doc)
+	wincmd p
+endfunction
+
+function! vimclojure#FindDoc()
+	let pattern = input("Pattern to look for: ")
+	let doc = vimclojure#ExecuteNailWithInput("FindDoc", pattern)
+	let buf = g:vimclojure#ResultBuffer.New()
+	call buf.showOutput(doc)
+	wincmd p
+endfunction
+
+let s:DefaultJavadocPaths = {
+			\ "java" : "http://java.sun.com/javase/6/docs/api/",
+			\ "org/apache/commons/beanutils" : "http://commons.apache.org/beanutils/api/",
+			\ "org/apache/commons/chain" : "http://commons.apache.org/chain/api-release/",
+			\ "org/apache/commons/cli" : "http://commons.apache.org/cli/api-release/",
+			\ "org/apache/commons/codec" : "http://commons.apache.org/codec/api-release/",
+			\ "org/apache/commons/collections" : "http://commons.apache.org/collections/api-release/",
+			\ "org/apache/commons/logging" : "http://commons.apache.org/logging/apidocs/",
+			\ "org/apache/commons/mail" : "http://commons.apache.org/email/api-release/",
+			\ "org/apache/commons/io" : "http://commons.apache.org/io/api-release/"
+			\ }
+
+if !exists("vimclojure#JavadocPathMap")
+	let vimclojure#JavadocPathMap = {}
+endif
+
+for k in keys(s:DefaultJavadocPaths)
+	if !has_key(vimclojure#JavadocPathMap, k)
+		let vimclojure#JavadocPathMap[k] = s:DefaultJavadocPaths[k]
+	endif
+endfor
+
+if !exists("vimclojure#Browser")
+	if has("win32") || has("win64")
+		let vimclojure#Browser = "start"
+	elseif has("mac")
+		let vimclojure#Browser = "open"
+	else
+		" some freedesktop thing, whatever, issue #67
+		let vimclojure#Browser = "xdg-open"
+	endif
+endif
+
+function! vimclojure#JavadocLookup(word)
+	let word = substitute(a:word, "\\.$", "", "")
+	let path = vimclojure#ExecuteNailWithInput("JavadocPath", word,
+				\ "-n", b:vimclojure_namespace)
+
+	if path.stderr != ""
+		let buf = g:vimclojure#ResultBuffer.New()
+		call buf.showOutput(path)
+		wincmd p
+		return
+	endif
+
+	let match = ""
+	for pattern in keys(g:vimclojure#JavadocPathMap)
+		if path.value =~ "^" . pattern && len(match) < len(pattern)
+			let match = pattern
+		endif
+	endfor
+
+	if match == ""
+		echoerr "No matching Javadoc URL found for " . path.value
+	endif
+
+	let url = g:vimclojure#JavadocPathMap[match] . path.value
+	call system(join([g:vimclojure#Browser, url], " "))
+endfunction
+
+function! vimclojure#SourceLookup(word)
+	let source = vimclojure#ExecuteNailWithInput("SourceLookup", a:word,
+				\ "-n", b:vimclojure_namespace)
+	let buf = g:vimclojure#ClojureResultBuffer.New(b:vimclojure_namespace)
+	call buf.showOutput(source)
+	wincmd p
+endfunction
+
+function! vimclojure#MetaLookup(word)
+	let meta = vimclojure#ExecuteNailWithInput("MetaLookup", a:word,
+				\ "-n", b:vimclojure_namespace)
+	let buf = g:vimclojure#ClojureResultBuffer.New(b:vimclojure_namespace)
+	call buf.showOutput(meta)
+	wincmd p
+endfunction
+
+function! vimclojure#GotoSource(word)
+	let pos = vimclojure#ExecuteNailWithInput("SourceLocation", a:word,
+				\ "-n", b:vimclojure_namespace)
+
+	if pos.stderr != ""
+		let buf = g:vimclojure#ResultBuffer.New()
+		call buf.showOutput(pos)
+		wincmd p
+		return
+	endif
+
+	if !filereadable(pos.value.file)
+		let file = findfile(pos.value.file)
+		if file == ""
+			echoerr pos.value.file . " not found in 'path'"
+			return
+		endif
+		let pos.value.file = file
+	endif
+
+	execute "edit " . pos.value.file
+	execute pos.value.line
+endfunction
+
+" Evaluators
+function! vimclojure#MacroExpand(firstOnly)
+	let [unused, sexp] = vimclojure#ExtractSexpr(0)
+	let ns = b:vimclojure_namespace
+
+	let cmd = ["MacroExpand", sexp, "-n", ns]
+	if a:firstOnly
+		let cmd = cmd + [ "-o" ]
+	endif
+
+	let expanded = call(function("vimclojure#ExecuteNailWithInput"), cmd)
+
+	let buf = g:vimclojure#ClojureResultBuffer.New(ns)
+	call buf.showOutput(expanded)
+	wincmd p
+endfunction
+
+function! vimclojure#RequireFile(all)
+	let ns = b:vimclojure_namespace
+	let all = a:all ? "-all" : ""
+
+	let require = "(require :reload" . all . " :verbose '". ns. ")"
+	let result = vimclojure#ExecuteNailWithInput("Repl", require, "-r")
+
+	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
+	call resultBuffer.showOutput(result)
+	wincmd p
+endfunction
+
+function! vimclojure#RunTests(all)
+	let ns = b:vimclojure_namespace
+
+	let result = call(function("vimclojure#ExecuteNailWithInput"),
+				\ [ "RunTests", "", "-n", ns ] + (a:all ? [ "-a" ] : []))
+	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
+	call resultBuffer.showOutput(result)
+	wincmd p
+endfunction
+
+function! vimclojure#EvalFile()
+	let content = getbufline(bufnr("%"), 1, line("$"))
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+
+	let result = vimclojure#ExecuteNailWithInput("Repl", content,
+				\ "-r", "-n", ns, "-f", file)
+
+	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
+	call resultBuffer.showOutput(result)
+	wincmd p
+endfunction
+
+function! vimclojure#EvalLine()
+	let theLine = line(".")
+	let content = getline(theLine)
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+
+	let result = vimclojure#ExecuteNailWithInput("Repl", content,
+				\ "-r", "-n", ns, "-f", file, "-l", theLine)
+
+	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
+	call resultBuffer.showOutput(result)
+	wincmd p
+endfunction
+
+function! vimclojure#EvalBlock()
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+
+	let content = getbufline(bufnr("%"), line("'<"), line("'>"))
+	let result = vimclojure#ExecuteNailWithInput("Repl", content,
+				\ "-r", "-n", ns, "-f", file, "-l", line("'<") - 1)
+
+	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
+	call resultBuffer.showOutput(result)
+	wincmd p
+endfunction
+
+function! vimclojure#EvalToplevel()
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+	let [pos, expr] = vimclojure#ExtractSexpr(1)
+
+	let result = vimclojure#ExecuteNailWithInput("Repl", expr,
+				\ "-r", "-n", ns, "-f", file, "-l", pos[0] - 1)
+
+	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
+	call resultBuffer.showOutput(result)
+	wincmd p
+endfunction
+
+function! ClojureEvalParagraphWorker() dict
+	normal! }
+	return line(".")
+endfunction
+
+function! vimclojure#EvalParagraph()
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+	let startPosition = line(".")
+
+	let closure = { 'f' : function("ClojureEvalParagraphWorker") }
+
+	let endPosition = vimclojure#util#WithSavedPosition(closure)
+
+	let content = getbufline(bufnr("%"), startPosition, endPosition)
+	let result = vimclojure#ExecuteNailWithInput("Repl", content,
+				\ "-r", "-n", ns, "-f", file, "-l", startPosition - 1)
+
+	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
+	call resultBuffer.showOutput(result)
+	wincmd p
+endfunction
+
+" The Repl
+let vimclojure#Repl = copy(vimclojure#Buffer)
+let vimclojure#Repl.__superBufferNew = vimclojure#Repl.New
+let vimclojure#Repl.__superBufferInit = vimclojure#Repl.Init
+
+let vimclojure#Repl._history = []
+let vimclojure#Repl._historyDepth = 0
+let vimclojure#Repl._replCommands = [ ",close", ",st", ",ct", ",toggle-pprint" ]
+
+" Simple wrapper to allow on demand load of autoload/vimclojure.vim.
+function! vimclojure#StartRepl(...)
+	let ns = a:0 > 0 ? a:1 : "user"
+	call g:vimclojure#Repl.New(ns)
+endfunction
+
+" FIXME: Ugly hack. But easier than cleaning up the buffer
+" mess in case something goes wrong with repl start.
+function! vimclojure#Repl.New(namespace) dict
+	let replStart = vimclojure#ExecuteNail("Repl", "-s",
+				\ "-n", a:namespace)
+	if replStart.stderr != ""
+		call vimclojure#ReportError(replStart.stderr)
+		return
+	endif
+
+	let instance = call(self.__superBufferNew, [a:namespace], self)
+	let instance._id = replStart.value.id
+	call vimclojure#ExecuteNailWithInput("Repl",
+				\ "(require 'clojure.stacktrace)",
+				\ "-r", "-i", instance._id)
+
+	return instance
+endfunction
+
+function! vimclojure#Repl.Init(namespace) dict
+	call self.__superBufferInit()
+
+	let self._prompt = a:namespace . "=>"
+
+	setlocal buftype=nofile
+	setlocal noswapfile
+
+	call append(line("$"), ["Clojure", self._prompt . " "])
+
+	let b:vimclojure_repl = self
+
+	set filetype=clojure
+	let b:vimclojure_namespace = a:namespace
+
+	if !hasmapto("<Plug>ClojureReplEnterHook", "i")
+		imap <buffer> <silent> <CR> <Plug>ClojureReplEnterHook
+	endif
+	if !hasmapto("<Plug>ClojureReplEvaluate", "i")
+		imap <buffer> <silent> <C-CR> <Plug>ClojureReplEvaluate
+	endif
+	if !hasmapto("<Plug>ClojureReplHatHook", "n")
+		nmap <buffer> <silent> ^ <Plug>ClojureReplHatHook
+	endif
+	if !hasmapto("<Plug>ClojureReplUpHistory", "i")
+		imap <buffer> <silent> <C-Up> <Plug>ClojureReplUpHistory
+	endif
+	if !hasmapto("<Plug>ClojureReplDownHistory", "i")
+		imap <buffer> <silent> <C-Down> <Plug>ClojureReplDownHistory
+	endif
+
+	normal! G
+	startinsert!
+endfunction
+
+function! vimclojure#Repl.isReplCommand(cmd) dict
+	for candidate in self._replCommands
+		if candidate == a:cmd
+			return 1
+		endif
+	endfor
+	return 0
+endfunction
+
+function! vimclojure#Repl.doReplCommand(cmd) dict
+	if a:cmd == ",close"
+		call vimclojure#ExecuteNail("Repl", "-S", "-i", self._id)
+		call self.close()
+		stopinsert
+	elseif a:cmd == ",st"
+		let result = vimclojure#ExecuteNailWithInput("Repl",
+					\ "(vimclojure.util/pretty-print-stacktrace *e)", "-r",
+					\ "-i", self._id)
+		call self.showOutput(result)
+		call self.showPrompt()
+	elseif a:cmd == ",ct"
+		let result = vimclojure#ExecuteNailWithInput("Repl",
+					\ "(vimclojure.util/pretty-print-causetrace *e)", "-r",
+					\ "-i", self._id)
+		call self.showOutput(result)
+		call self.showPrompt()
+	elseif a:cmd == ",toggle-pprint"
+		let result = vimclojure#ExecuteNailWithInput("Repl",
+					\ "(set! vimclojure.repl/*print-pretty* (not vimclojure.repl/*print-pretty*))", "-r",
+					\ "-i", self._id)
+		call self.showOutput(result)
+		call self.showPrompt()
+	endif
+endfunction
+
+function! vimclojure#Repl.showPrompt() dict
+	call self.showText(self._prompt . " ")
+	normal! G
+	startinsert!
+endfunction
+
+function! vimclojure#Repl.getCommand() dict
+	let ln = line("$")
+
+	while getline(ln) !~ "^" . self._prompt && ln > 0
+		let ln = ln - 1
+	endwhile
+
+	" Special Case: User deleted Prompt by accident. Insert a new one.
+	if ln == 0
+		call self.showPrompt()
+		return ""
+	endif
+
+	let cmd = vimclojure#util#Yank("l", ln . "," . line("$") . "yank l")
+
+	let cmd = substitute(cmd, "^" . self._prompt . "\\s*", "", "")
+	let cmd = substitute(cmd, "\n$", "", "")
+	return cmd
+endfunction
+
+function! vimclojure#ReplDoEnter()
+	execute "normal! a\<CR>x"
+	normal! ==x
+	if getline(".") =~ '^\s*$'
+		startinsert!
+	else
+		startinsert
+	endif
+endfunction
+
+function! vimclojure#Repl.enterHook() dict
+	let lastCol = {}
+
+	function lastCol.f() dict
+		normal! g_
+		return col(".")
+	endfunction
+
+	if line(".") < line("$") || col(".") < vimclojure#util#WithSavedPosition(lastCol)
+		call vimclojure#ReplDoEnter()
+		return
+	endif
+
+	let cmd = self.getCommand()
+
+	" Special Case: Showed prompt (or user just hit enter).
+	if cmd =~ '^\(\s\|\n\)*$'
+		execute "normal! a\<CR>"
+		startinsert!
+		return
+	endif
+
+	if self.isReplCommand(cmd)
+		call self.doReplCommand(cmd)
+		return
+	endif
+
+	let result = vimclojure#ExecuteNailWithInput("CheckSyntax", cmd,
+				\ "-n", b:vimclojure_namespace)
+	if result.value == 0 && result.stderr == ""
+		call vimclojure#ReplDoEnter()
+	elseif result.stderr != ""
+		let buf = g:vimclojure#ResultBuffer.New()
+		call buf.showOutput(result)
+	else
+		let result = vimclojure#ExecuteNailWithInput("Repl", cmd,
+					\ "-r", "-i", self._id)
+		call self.showOutput(result)
+
+		let self._historyDepth = 0
+		let self._history = [cmd] + self._history
+
+		let namespace = vimclojure#ExecuteNailWithInput("ReplNamespace", "",
+					\ "-i", self._id)
+		let b:vimclojure_namespace = namespace.value
+		let self._prompt = namespace.value . "=>"
+
+		call self.showPrompt()
+	endif
+endfunction
+
+function! vimclojure#Repl.hatHook() dict
+	let l = getline(".")
+
+	if l =~ "^" . self._prompt
+		let [buf, line, col, off] = getpos(".")
+		call setpos(".", [buf, line, len(self._prompt) + 2, off])
+	else
+		normal! ^
+	endif
+endfunction
+
+function! vimclojure#Repl.upHistory() dict
+	let histLen = len(self._history)
+	let histDepth = self._historyDepth
+
+	if histLen > 0 && histLen > histDepth
+		let cmd = self._history[histDepth]
+		let self._historyDepth = histDepth + 1
+
+		call self.deleteLast()
+
+		call self.showText(self._prompt . " " . cmd)
+	endif
+
+	normal! G$
+endfunction
+
+function! vimclojure#Repl.downHistory() dict
+	let histLen = len(self._history)
+	let histDepth = self._historyDepth
+
+	if histDepth > 0 && histLen > 0
+		let self._historyDepth = histDepth - 1
+		let cmd = self._history[self._historyDepth]
+
+		call self.deleteLast()
+
+		call self.showText(self._prompt . " " . cmd)
+	elseif histDepth == 0
+		call self.deleteLast()
+		call self.showText(self._prompt . " ")
+	endif
+
+	normal! G$
+endfunction
+
+function! vimclojure#Repl.deleteLast() dict
+	normal! G
+
+	while getline("$") !~ self._prompt
+		normal! dd
+	endwhile
+
+	normal! dd
+endfunction
+
+" Highlighting
+function! vimclojure#ColorNamespace(highlights)
+	for [category, words] in items(a:highlights)
+		if words != []
+			execute "syntax keyword clojure" . category . " " . join(words, " ")
+		endif
+	endfor
+endfunction
+
+" Omni Completion
+function! vimclojure#OmniCompletion(findstart, base)
+	if a:findstart == 1
+		let line = getline(".")
+		let start = col(".") - 1
+
+		while start > 0 && line[start - 1] =~ '\w\|-\|\.\|+\|*\|/'
+			let start -= 1
+		endwhile
+
+		return start
+	else
+		let slash = stridx(a:base, '/')
+		if slash > -1
+			let prefix = strpart(a:base, 0, slash)
+			let base = strpart(a:base, slash + 1)
+		else
+			let prefix = ""
+			let base = a:base
+		endif
+
+		if prefix == "" && base == ""
+			return []
+		endif
+
+		let completions = vimclojure#ExecuteNail("Complete",
+					\ "-n", b:vimclojure_namespace,
+					\ "-p", prefix, "-b", base)
+		return completions.value
+	endif
+endfunction
+
+function! vimclojure#InitBuffer(...)
+	if exists("b:vimclojure_loaded")
+		return
+	endif
+	let b:vimclojure_loaded = 1
+
+	if g:vimclojure#WantNailgun == 1
+		if !exists("b:vimclojure_namespace")
+			" Get the namespace of the buffer.
+			if &previewwindow
+				let b:vimclojure_namespace = "user"
+			else
+				try
+					let content = getbufline(bufnr("%"), 1, line("$"))
+					let namespace =
+								\ vimclojure#ExecuteNailWithInput(
+								\   "NamespaceOfFile", content)
+					if namespace.stderr != ""
+						throw namespace.stderr
+					endif
+					let b:vimclojure_namespace = namespace.value
+				catch /.*/
+					if a:000 == []
+						call vimclojure#ReportError(
+									\ "Could not determine the Namespace of the file.\n\n"
+									\ . "This might have different reasons. Please check, that the ng server\n"
+									\ . "is running with the correct classpath and that the file does not contain\n"
+									\ . "syntax errors. The interactive features will not be enabled, ie. the\n"
+									\ . "keybindings will not be mapped.\n\nReason:\n" . v:exception)
+					endif
+				endtry
+			endif
+		endif
+	endif
+endfunction
+
+function! vimclojure#AddToLispWords(word)
+	execute "setlocal lw+=" . a:word
+endfunction
+
+function! vimclojure#ToggleParenRainbow()
+	highlight clear clojureParen1
+	highlight clear clojureParen2
+	highlight clear clojureParen3
+	highlight clear clojureParen4
+	highlight clear clojureParen5
+	highlight clear clojureParen6
+	highlight clear clojureParen7
+	highlight clear clojureParen8
+	highlight clear clojureParen9
+
+	let g:vimclojure#ParenRainbow = !g:vimclojure#ParenRainbow
+
+	if g:vimclojure#ParenRainbow != 0
+		if &background == "dark"
+			highlight clojureParen1 ctermfg=yellow      guifg=orange1
+			highlight clojureParen2 ctermfg=green       guifg=yellow1
+			highlight clojureParen3 ctermfg=cyan        guifg=greenyellow
+			highlight clojureParen4 ctermfg=magenta     guifg=green1
+			highlight clojureParen5 ctermfg=red         guifg=springgreen1
+			highlight clojureParen6 ctermfg=yellow      guifg=cyan1
+			highlight clojureParen7 ctermfg=green       guifg=slateblue1
+			highlight clojureParen8 ctermfg=cyan        guifg=magenta1
+			highlight clojureParen9 ctermfg=magenta     guifg=purple1
+		else
+			highlight clojureParen1 ctermfg=darkyellow  guifg=orangered3
+			highlight clojureParen2 ctermfg=darkgreen   guifg=orange2
+			highlight clojureParen3 ctermfg=blue        guifg=yellow3
+			highlight clojureParen4 ctermfg=darkmagenta guifg=olivedrab4
+			highlight clojureParen5 ctermfg=red         guifg=green4
+			highlight clojureParen6 ctermfg=darkyellow  guifg=paleturquoise3
+			highlight clojureParen7 ctermfg=darkgreen   guifg=deepskyblue4
+			highlight clojureParen8 ctermfg=blue        guifg=darkslateblue
+			highlight clojureParen9 ctermfg=darkmagenta guifg=darkviolet
+		endif
+	else
+		highlight link clojureParen1 clojureParen0
+		highlight link clojureParen2 clojureParen0
+		highlight link clojureParen3 clojureParen0
+		highlight link clojureParen4 clojureParen0
+		highlight link clojureParen5 clojureParen0
+		highlight link clojureParen6 clojureParen0
+		highlight link clojureParen7 clojureParen0
+		highlight link clojureParen8 clojureParen0
+		highlight link clojureParen9 clojureParen0
+	endif
+endfunction
+
+" Epilog
+let &cpo = s:save_cpo

File .vim/autoload/vimclojure/util.vim

+" Part of Vim filetype plugin for Clojure
+" Language:     Clojure
+" Maintainer:   Meikel Brandmeyer <mb@kotka.de>
+
+let s:save_cpo = &cpo
+set cpo&vim
+
+function! vimclojure#util#SynIdName()
+	return synIDattr(synID(line("."), col("."), 0), "name")
+endfunction
+
+function! vimclojure#util#WithSaved(closure)
+	let v = a:closure.save()
+	try
+		let r = a:closure.f()
+	finally
+		call a:closure.restore(v)
+	endtry
+	return r
+endfunction
+
+function! s:SavePosition() dict
+	let [ _b, l, c, _o ] = getpos(".")
+	let b = bufnr("%")
+	return [b, l, c]
+endfunction
+
+function! s:RestorePosition(value) dict
+	let [b, l, c] = a:value
+
+	if bufnr("%") != b
+		execute b "buffer!"
+	endif
+	call setpos(".", [0, l, c, 0])
+endfunction
+
+function! vimclojure#util#WithSavedPosition(closure)
+	let a:closure.save = function("s:SavePosition")
+	let a:closure.restore = function("s:RestorePosition")
+
+	return vimclojure#util#WithSaved(a:closure)
+endfunction
+
+function! s:SaveRegister(reg)
+	return [a:reg, getreg(a:reg, 1), getregtype(a:reg)]
+endfunction
+
+function! s:SaveRegisters() dict
+	return map([self._register, "", "/", "-",
+				\ "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+				\ "s:SaveRegister(v:val)")
+endfunction
+
+function! s:RestoreRegisters(registers) dict
+	for register in a:registers
+		call call(function("setreg"), register)
+	endfor
+endfunction
+
+function! vimclojure#util#WithSavedRegister(reg, closure)
+	let a:closure._register = a:reg
+	let a:closure.save = function("s:SaveRegisters")
+	let a:closure.restore = function("s:RestoreRegisters")
+
+	return vimclojure#util#WithSaved(a:closure)
+endfunction
+
+function! s:SaveOption() dict
+	return eval("&" . self._option)
+endfunction
+
+function! s:RestoreOption(value) dict
+	execute "let &" . self._option . " = a:value"
+endfunction
+
+function! vimclojure#util#WithSavedOption(option, closure)
+	let a:closure._option = a:option
+	let a:closure.save = function("s:SaveOption")
+	let a:closure.restore = function("s:RestoreOption")
+
+	return vimclojure#util#WithSaved(a:closure)
+endfunction
+
+function! s:DoYank() dict
+	silent execute self.yank
+	return getreg(self.reg)
+endfunction
+
+function! vimclojure#util#Yank(r, how)
+	let closure = {
+				\ 'reg': a:r,
+				\ 'yank': a:how,
+				\ 'f': function("s:DoYank")
+				\ }
+
+	return vimclojure#util#WithSavedRegister(a:r, closure)
+endfunction
+
+function! vimclojure#util#MoveBackward()
+	call search('\S', 'Wb')
+endfunction
+
+function! vimclojure#util#MoveForward()
+	call search('\S', 'W')
+endfunction
+
+" Epilog
+let &cpo = s:save_cpo

File .vim/bin/clj

+#!/bin/bash
+
+# Copyright (c) Stephen C. Gilardi. All rights reserved.  The use and
+# distribution terms for this software are covered by the Eclipse Public
+# License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be
+# found in the file epl-v10.html at the root of this distribution.  By
+# using this software in any fashion, you are agreeing to be bound by the
+# terms of this license.  You must not remove this notice, or any other,
+# from this software.
+#
+# clj-env-dir Launches Clojure, passing along command line arguments. This
+#             launcher can be configured using environment variables and
+#             makes it easy to include directories full of classpath roots
+#             in CLASSPATH.
+#
+# scgilardi (gmail)
+# Created 7 January 2009
+#
+# Modified to read in an optional .clojure file in the current directory
+# naming further items for the CLASSPATH.
+#
+# Meikel Brandmeyer (mb ? kotka ! de)
+# Frankfurt am Main, 21.08.2009
+#
+# Environment variables (optional):
+#
+#  CLOJURE_EXT  Colon-delimited list of paths to directories whose top-level
+#               contents are (either directly or as symbolic links) jar
+#               files and/or directories whose paths will be in Clojure's
+#               classpath. The value of the CLASSPATH environment variable
+#               for Clojure will include these top-level paths followed by
+#               the previous value of CLASSPATH (if any).
+#               default:
+#               example: /usr/local/share/clojure/ext:$HOME/.clojure.d/ext
+#
+#  CLOJURE_JAVA The command to launch a JVM instance for Clojure
+#               default: java
+#               example: /usr/local/bin/java6
+#
+#  CLOJURE_OPTS Java options for this JVM instance
+#               default:
+#               example:"-Xms32M -Xmx128M -server"
+#
+#  CLOJURE_MAIN The Java class to launch
+#               default: clojure.main
+#               example: clojure.contrib.repl_ln
+
+set -o errexit
+#set -o nounset
+#set -o xtrace
+
+if [ -n "${CLOJURE_EXT:-}" ]; then
+    OLD="$IFS"
+    IFS=":"
+    EXT="$(find -H ${CLOJURE_EXT} -mindepth 1 -maxdepth 1 -print0 | tr \\0 \:)"
+    IFS="$OLD"
+    if [ -n "${CLASSPATH:-}" ]; then
+        CLASSPATH="${EXT}${CLASSPATH}"
+    else
+        CLASSPATH="${EXT%:}"
+    fi
+fi
+
+if [ -f .clojure ]; then
+    for path in `cat .clojure`; do
+        if [ -n "${CLASSPATH:-}" ]; then
+            CLASSPATH="${path}:${CLASSPATH}"
+        else
+            CLASSPATH="${path%:}"
+        fi
+    done
+fi
+
+export CLASSPATH
+
+JAVA=${CLOJURE_JAVA:-java}
+OPTS=${CLOJURE_OPTS:-}
+MAIN=${CLOJURE_MAIN:-clojure.main}
+
+exec ${JAVA} ${OPTS} ${MAIN} "$@"

File .vim/bin/clj.bat

+@ECHO OFF
+
+REM # Copyright (c) Stephen C. Gilardi. All rights reserved.  The use and
+REM # distribution terms for this software are covered by the Eclipse Public
+REM # License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be
+REM # found in the file epl-v10.html at the root of this distribution.  By
+REM # using this software in any fashion, you are agreeing to be bound by the
+REM # terms of this license.  You must not remove this notice, or any other,
+REM # from this software.
+REM #
+REM # scgilardi (gmail)
+REM # Created 7 January 2009
+REM #
+REM # Modified by Justin Johnson <justin _ honesthacker com> to run on Windows
+REM # and to include a check for .clojure file in the current directory.
+REM #
+REM # Environment variables:
+REM #
+REM # Optional:
+REM #
+REM #  CLOJURE_EXT  The path to a directory containing (either directly or as
+REM #               symbolic links) jar files and/or directories whose paths
+REM #               should be in Clojure's classpath. The value of the
+REM #               CLASSPATH environment variable for Clojure will be a list
+REM #               of these paths followed by the previous value of CLASSPATH
+REM #               (if any).
+REM #
+REM #  CLOJURE_JAVA The command to launch a JVM instance for Clojure
+REM #               default: java
+REM #               example: /usr/local/bin/java6
+REM #
+REM #  CLOJURE_OPTS Java options for this JVM instance
+REM #               default:
+REM #               example:"-Xms32M -Xmx128M -server"
+REM #
+REM # Configuration files:
+REM # 
+REM # Optional:
+REM #
+REM #  .clojure     A file sitting in the directory where you invoke ng-server.
+REM #               Each line contains a single path that should be added to the classpath.
+REM #
+
+SETLOCAL ENABLEDELAYEDEXPANSION
+
+REM # Add all jar files from CLOJURE_EXT directory to classpath
+IF DEFINED CLOJURE_EXT FOR %%E IN ("%CLOJURE_EXT%\*") DO SET CP=!CP!;%%~fE
+
+IF NOT DEFINED CLOJURE_JAVA SET CLOJURE_JAVA=java
+
+REM # If the current directory has a .clojure file in it, add each path
+REM # in the file to the classpath.
+IF EXIST .clojure FOR /F %%E IN (.clojure) DO SET CP=!CP!;%%~fE
+
+%CLOJURE_JAVA% %CLOJURE_OPTS% -cp "%CP%" clojure.main %1 %2 %3 %4 %5 %6 %7 %8 %9

File .vim/bin/kickoff.sh

+#! /usr/bin/env bash
+
+GRADLE_REV="0.8"
+GRADLE_URL="http://dist.codehaus.org/gradle/gradle-${GRADLE_REV}-bin.zip"
+GRADLE_ZIP="gradle.zip"
+GRADLE_DIR="gradle-${GRADLE_REV}"
+
+PLUGIN_REV="1.3.0"
+PLUGIN_URL="http://clojars.org/repo/clojuresque/clojuresque/${PLUGIN_REV}/clojuresque-${PLUGIN_REV}.jar"
+PLUGIN_JAR="clojuresque-${PLUGIN_REV}.jar"
+
+CACHE_DIR="cache"
+CACHE_GRADLE_ZIP="${CACHE_DIR}/${GRADLE_ZIP}"
+CACHE_GRADLE_DIR="${CACHE_DIR}/${GRADLE_DIR}"
+
+if [ ! -e "${CACHE_DIR}" ]; then
+    mkdir "${CACHE_DIR}"
+fi
+
+if [ ! -e "${CACHE_GRADLE_ZIP}" ]; then
+    wget ${GRADLE_URL} -O "${CACHE_GRADLE_ZIP}"
+fi
+
+if [ ! -e "${CACHE_GRADLE_DIR}" ]; then
+    pushd .
+    cd "${CACHE_DIR}"
+    unzip "${GRADLE_ZIP}"
+    popd
+fi
+
+if [ ! -e "${CACHE_PLUGIN_DIR}" ]; then
+    wget ${PLUGIN_URL} -O "${CACHE_GRADLE_DIR}/lib/${PLUGIN_JAR}"
+fi
+
+echo "clojure=clojuresque.ClojurePlugin" >> "${CACHE_GRADLE_DIR}/plugin.properties"
+
+echo "Don't forget to set GRADLE_HOME!"
+echo "export GRADLE_HOME=\"${CACHE_GRADLE_DIR}\""

File .vim/bin/ng-server

+#! /usr/bin/env bash
+
+# Copyright (c) Stephen C. Gilardi. All rights reserved.  The use and
+# distribution terms for this software are covered by the Eclipse Public
+# License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be
+# found in the file epl-v10.html at the root of this distribution.  By
+# using this software in any fashion, you are agreeing to be bound by the
+# terms of this license.  You must not remove this notice, or any other,
+# from this software.
+#
+# clj-env-dir Launches Clojure, passing along command line arguments. This
+#             launcher can be configured using environment variables and
+#             makes it easy to include directories full of classpath roots
+#             in CLASSPATH.
+#
+# scgilardi (gmail)
+# Created 7 January 2009
+#
+# Modified to act as launcher for the Nailgun server and to read in an
+# optional .clojure file in the current directory naming further items
+# for the CLASSPATH.
+#
+# Meikel Brandmeyer (mb ? kotka ! de)
+# Frankfurt am Main, 21.08.2009
+#
+# Environment variables (optional):
+#
+#  CLOJURE_EXT  Colon-delimited list of paths to directories whose top-level
+#               contents are (either directly or as symbolic links) jar
+#               files and/or directories whose paths will be in Clojure's
+#               classpath. The value of the CLASSPATH environment variable
+#               for Clojure will include these top-level paths followed by
+#               the previous value of CLASSPATH (if any).
+#               default:
+#               example: /usr/local/share/clojure/ext:$HOME/.clojure.d/ext
+#
+#  CLOJURE_JAVA The command to launch a JVM instance for Clojure
+#               default: java
+#               example: /usr/local/bin/java6
+#
+#  CLOJURE_OPTS Java options for this JVM instance
+#               default:
+#               example:"-Xms32M -Xmx128M -server"
+#
+#  .clojure     A file in the current directory. Every line names an item
+#               which will be added to the CLASSPATH.
+
+set -o errexit
+#set -o nounset
+#set -o xtrace
+
+if [ -n "${CLOJURE_EXT:-}" ]; then
+    OLD="$IFS"
+    IFS=":"
+    EXT="$(find -H ${CLOJURE_EXT} -mindepth 1 -maxdepth 1 -print0 | tr \\0 \:)"
+    IFS="$OLD"
+    if [ -n "${CLASSPATH:-}" ]; then
+        export CLASSPATH="${EXT}${CLASSPATH}"
+    else
+        export CLASSPATH="${EXT%:}"
+    fi
+fi
+
+if [ -f .clojure ]; then
+    for path in `cat .clojure`; do
+        if [ -n "${CLASSPATH:-}" ]; then
+            export CLASSPATH="${path}:${CLASSPATH}"
+        else
+            export CLASSPATH="${path%:}"
+        fi
+    done
+fi
+
+JAVA=${CLOJURE_JAVA:-java}
+OPTS=${CLOJURE_OPTS:-}
+
+exec ${JAVA} ${OPTS} vimclojure.nailgun.NGServer 127.0.0.1 "$@"

File .vim/bin/ng-server.bat

+@ECHO OFF
+
+REM # Copyright (c) Stephen C. Gilardi. All rights reserved.  The use and
+REM # distribution terms for this software are covered by the Eclipse Public
+REM # License 1.0 (http://opensource.org/licenses/eclipse-1.0.php) which can be
+REM # found in the file epl-v10.html at the root of this distribution.  By
+REM # using this software in any fashion, you are agreeing to be bound by the
+REM # terms of this license.  You must not remove this notice, or any other,
+REM # from this software.
+REM #
+REM # scgilardi (gmail)
+REM # Created 7 January 2009
+REM #
+REM # Modified by Justin Johnson <justin _ honesthacker com> to act as Windows
+REM # launcher for the Nailgun server of VimClojure, and to include a check for
+REM # a .clojure file in the current directory.
+REM #
+REM # Environment variables:
+REM #
+REM # Optional:
+REM #
+REM #  CLOJURE_EXT  The path to a directory containing (either directly or as
+REM #               symbolic links) jar files and/or directories whose paths
+REM #               should be in Clojure's classpath. The value of the
+REM #               CLASSPATH environment variable for Clojure will be a list
+REM #               of these paths followed by the previous value of CLASSPATH
+REM #               (if any).
+REM #
+REM #  CLOJURE_JAVA The command to launch a JVM instance for Clojure
+REM #               default: java
+REM #               example: /usr/local/bin/java6
+REM #
+REM #  CLOJURE_OPTS Java options for this JVM instance
+REM #               default:
+REM #               example:"-Xms32M -Xmx128M -server"
+REM #
+REM # Configuration files:
+REM # 
+REM # Optional:
+REM #
+REM #  .clojure     A file sitting in the directory where you invoke ng-server.
+REM #               Each line contains a single path that should be added to the classpath.
+REM #
+
+SETLOCAL ENABLEDELAYEDEXPANSION
+
+REM # Add all jar files from CLOJURE_EXT directory to classpath
+IF DEFINED CLOJURE_EXT FOR %%E IN ("%CLOJURE_EXT%\*") DO SET CP=!CP!;%%~fE
+
+IF NOT DEFINED CLOJURE_JAVA SET CLOJURE_JAVA=java
+
+REM # If the current directory has a .clojure file in it, add each path
+REM # in the file to the classpath.
+IF EXIST .clojure FOR /F %%E IN (.clojure) DO SET CP=!CP!;%%~fE
+
+REM # Since we do not provide any security we at least bind only to the loopback.
+%CLOJURE_JAVA% %CLOJURE_OPTS% -cp "%CP%" vimclojure.nailgun.NGServer 127.0.0.1 %1 %2 %3 %4 %5 %6 %7 %8 %9

File .vim/doc/clojure.txt

 >
         aucmd BufRead,BufNewFile *.clj nmap xyz <Plug>ClojureEvalToplevel
 <
+To inhibit all mappings set the global flag to zero:
+>
+        let vimclojure#SetupKeyMap = 0
+<
+To inhibit only single mappings append the plug name:
+>
+        let vimclojure#SetupKeyMapEvalToplevel = 0
+<
+To enable only single mappings first turn off all flags, and then
+whitelist the ones you want to be enabled:
+>
+        let vimclojure#SetupKeyMap = 0
+        let vimclojure#SetupKeyMapEvalToplevel = 1
+<
+Whatever setting: it will still honor any key mapping made by yourself.
 
 <LocalLeader>et                                 *et* *EvalToplevel*
                         Send off the toplevel sexpression currently

File .vim/doc/paredit.txt

+*paredit.txt*                   Paredit              Last Change: 01 Apr 2012
+
+Paredit Mode for Vim                                  *paredit* *slimv-paredit*
+                               Version 0.9.6
+
+The paredit.vim plugin performs structured editing of s-expressions used in
+the Lisp, Clojure, Scheme programming languages. It may come as part of Slimv
+but it is also distributed separately as a standalone plugin.
+
+|paredit-mode|               Paredit mode
+|paredit-keys|               Paredit keybindings
+|paredit-options|            Paredit options
+
+===============================================================================
+PAREDIT MODE                                                     *paredit-mode*
+
+Paredit mode is a special editing mode that keeps all matched characters
+(parentheses, square and curly braces, double quotes) balanced, i.e. all opening
+characters have a matching closing character. Most text entering and erasing
+commands try to maintain the balanced state, so no single matched character is
+added or deleted, they are entered or removed in pairs.
+The function takes care of strings and comments, so no parenthesis and square
+bracket balancing is performed inside a string or comment.
+Please note that [] and {} pairs are not balanced for Lisp filetypes, only
+for Clojure.
+
+The idea is taken from the paredit mode of Emacs, but not all paredit.el
+editing functions are implemented or behave exactly the same way as they do
+in Emacs.
+
+When you enter a '(' then a matching ')' is automatically inserted.
+If needed, spaces before and/or after the '()' pair are added.
+
+When you press ')' in insert mode then there's no need to insert a closing
+parenthesis mark (it is already there), so the cursor is simply advanced past
+the next closing parenthesis (then the next outer closing parenthesis, etc.).
+The result of this is however that when entering text with paredit mode
+you can use the same keystrokes as without paredit mode and you get the same
+result. Of course you can choose to not enter the closing parenthesis (as
+required without paredit mode), because it is already there.
+
+When you are trying to delete a ')' alone then it is not possible, the cursor
+is simply moved inside the list, where all regular characters can be deleted.
+When the list is finally empty: '()', then the deletion of the opening '('
+makes both parentheses erased at once, so the balanced state is maintained.
+
+All the above holds for [...] and "..." character pairs.
+
+When you are deleting multiple characters at once, e.g. deleting a whole line,
+or deleting till the end of the line, etc, then the deletion logic of a single
+character is iterated. This means that the whole line or the characters till
+the end of the line, etc are not necessarily deleted all. Depending on the
+number of open/close parentheses, square or curly braces, double quotes some
+of them might be kept in order to maintain the balanced state.
+For example if you press D in Normal mode to delete till the end of line
+between the a and b parameters of the following Clojure function definition:
+
+(defn myfunc [a b c] (+ a b c))
+               ^--- press D here
+
+then the closing ] as well as the last closing ) will not be deleted, because
+in the list you have an ( and a [ to be matched, so the result will be:
+
+(defn myfunc [a])
+
+If you are deleting multiple lines, then the above process is performed for
+all lines involved. If a line was not completely cleared, then it is joined
+with the next line and the process continues.
+
+
+Of course not all Vim commands are compatible with the paredit mode (e.g.
+you can yank and paste unbalanced code snippet, or comment out an asymmetrical
+part of the code), and there is also the possibility to edit the source code
+with paredit mode switched off or with another editor to make it unbalanced.
+When paredit mode detects that the underlying code is not balanced, then the
+paredit functionality is suspended until the top level form balance is fixed.
+As soon as all parens are matched, the paredit mode is automatically resumed.
+Paredit needs "syntax on" to identify the syntax elements of the underlying
+code, so if syntax is switched off, then paredit will not be suspended inside
+comments or strings.
+
+
+Slurpage and Barfage known from Emacs is also possible but in a different
+fashion: you don't move the symbols but move the opening or closing parenthesis
+over the symbol or a sub-list. This way you can move any symbol or sub-list
+into or out of the current list. It is not possible to move the parenthesis
+over its pair, so for example if you move the opening parenthesis to the right,
+then it will stop at the matched closing parenthesis.
+
+
+Paredit mode is set by default for .lisp, .cl, .clj, cljs, .scm and .rkt files,
+but it is possible to switch it off by putting the following statement in the
+.vimrc file:
+
+    let g:paredit_mode = 0
+
+You can enable paredit mode for other file types as well. Here is how to set
+it for Arc files (meant to be added to your .vimrc file):
+
+    au BufNewFile,BufRead *.arc call PareditInitBuffer()
+
+Paredit is part of Slimv, but it is also distributed separately as a standalone
+plugin. If you indend to use the SWANK client and/or Slimv's indentation and
+syntax functions, then please install the Slimv plugin. Otherwise you may want
+to install the Paredit plugin thus omitting other unnecessary files.
+
+
+===============================================================================
+PAREDIT KEYBINDINGS                                              *paredit-keys*
+
+Here follows a list of paredit keybindings:
+
+
+Insert Mode:
+
+    (              Inserts '()' and moves the cursor inside. Also adds leading
+                   or trailing spaces when needed.
+                   Inserts '(' when inside comment or string.
+
+    )              Moves the cursor to the next closing parenthesis mark of
+                   the current list. When pressed again then moves to the next
+                   outer closing parenthesis, etc, until the closing of the
+                   top level form is reached.
+                   Inserts ')' when inside comment or string.
+
+    [              Inserts '[]' and moves the cursor inside. Also adds leading
+                   or trailing spaces when needed.
+                   Inserts '[' when inside comment or string.
+
+    ]              Moves the cursor to the next closing square bracket of the
+                   current list. When pressed again then moves to the next
+                   outer closing square bracket, etc, until the closing of the
+                   top level form is reached.
+                   Inserts ']' when inside comment or string.
+
+    {              Inserts '{}' and moves the cursor inside. Also adds leading
+                   or trailing spaces when needed.
+                   Inserts '{' when inside comment or string.
+
+    }              Moves the cursor to the next closing curly brace of the
+                   current list. When pressed again then moves to the next
+                   outer closing curly brace, etc, until the closing of the
+                   top level form is reached.
+                   Inserts '}' when inside comment or string.
+
+    "              When outside of string, inserts '""' and moves the cursor
+                   inside. When inside string then moves to the closing '"'.                   
+                   Inserts '"' when inside comment. Also insert '"' when inside
+                   string and preceded by a '\'.
+
+    <BS>           When about to delete a (, ), [, ], or " and there are other
+                   characters inside, then just skip it to the left. When
+                   about to delete the opening part of the matched character
+                   with nothing inside, then the whole empty list is removed.
+
+    <Del>          When about to delete a (, ), [, ], or " and there are other
+                   characters inside, then just skip it to the right. When
+                   about to delete the closing part of the matched character
+                   with nothing inside, then the whole empty list is removed.
+
+
+Normal Mode:
+
+    (              Finds opening '(' of the current list. Can be pressed
+                   repeatedly until the opening of the top level form reached.
+
+    )              Finds closing ')' of the current list. Can be pressed
+                   repeatedly until the closing of the top level form reached.
+
+    [[             Go to the start of current/previous defun.
+
+    ]]             Go to the start of next defun.
+
+    <Leader><      If standing on a delimiter (parenthesis or square bracket)
+                   then moves it to the left by slurping or barfing the
+                   s-expression to the left, depending on the direction of the
+                   delimiter:
+                   Pressing '<' when standing on a ')' makes the s-expression
+                   to the left of the ')' going out of the current list.
+                   Pressing '<' when standing on a '(' makes the s-expression
+                   to the left of the '(' coming into the current list.
+                   For example pressing <Leader>< at position marked with |:
+                       (aaa bbb|)        --->    (aaa) bbb
+                       aaa |(bbb)        --->    (aaa bbb)
+
+    <Leader>>      If standing on a delimiter (parenthesis or square bracket)
+                   then moves it to the right by slurping or barfing the
+                   s-expression to the right, depending on the direction of the
+                   delimiter:
+                   Pressing '>' when standing on a '(' makes the s-expression
+                   to the right of the '(' going out of the current list.
+                   Pressing '>' when standing on a ')' makes the s-expression
+                   to the right of the ')' coming into the current list.
+                   For example pressing <Leader>< at position marked with |:
+                       (aaa|) bbb        --->    (aaa bbb)
+                       |(aaa bbb)        --->    aaa (bbb)
+
+    <Leader>J      Join two subsequent lists or strings. The first one must end
+                   before the cursor, the second one must start after the
+                   cursor position.
+                   For example pressing <Leader>J at position marked with |:
+                       (aaa)| (bbb)      --->    (aaa bbb)
+                       "aaa"| "bbb"      --->    "aaa bbb"
+
+    <Leader>O      Split ("Open") current list or string at the cursor position.
+                   Opposite of Join. Key O is selected because for the original
+                   Vim mapping J and O are also kind of opposites.
+                   For example pressing <Leader>O at position marked with |:
+                       (aaa |bbb)        --->    (aaa) (bbb)
+                       "aaa|bbb"         --->    "aaa" "bbb"
+
+    <Leader>W      Wrap the current symbol in a pair of parentheses. The cursor
+    <Leader>w(     is then positioned on the opening parenthesis, as wrapping
+                   is usually done because one wants to call a function with
+                   the symbol as parameter, so by pressing "a" one can enter
+                   the function name right after the newly inserted "(".
+                   For example pressing <Leader>W at position marked with |:
+                       (aaa b|bb ccc)    --->    (aaa (bbb) ccc)
+
+    <Leader>w[     Wrap the current symbol in a pair of square brackets,
+                   similarly to <Leader>W.
+                   For example pressing <Leader>w[ at position marked with |:
+                       (aaa b|bb ccc)    --->    (aaa [bbb] ccc)
+
+    <Leader>w{     Wrap the current symbol in a pair of curly braces,
+                   similarly to <Leader>W.
+                   For example pressing <Leader>w{ at position marked with |:
+                       (aaa b|bb ccc)    --->    (aaa {bbb} ccc)
+
+    <Leader>w"     Wrap the current symbol in a pair of double quotes,
+                   similarly to <Leader>W.
+                   For example pressing <Leader>w" at position marked with |:
+                       (aaa b|bb ccc)    --->    (aaa "bbb" ccc)
+
+    <Leader>S      Splice the current list into the containing list, i.e.
+                   remove the opening and closing parens. Opposite of wrap.
+                   For example pressing <Leader>S at position marked with |:
+                       (aaa (b|bb) ccc)  --->    (aaa bbb ccc)
+
+    x  or  <Del>   When about to delete a (, ), [, ], or " and there are other
+                   characters inside, then just skip it to the right. When
+                   about to delete the closing part of the matched character
+                   with nothing inside, then the whole empty list is removed.
+                   When preceded by a <count> value then delete this many
+                   characters.
+
+    X              When about to delete a (, ), [, ], or " and there are other
+                   characters inside, then just skip it to the left. When
+                   about to delete the opening part of the matched character
+                   with nothing inside, then the whole empty list is removed.
+
+    D              Keep deleting characters towards the end of line,
+                   maintaining the balanced state, i.e. keep the number of
+                   opening and closing parens the same.
+
+    C              Same as 'D' but go to insert mode at the end.
+
+    s              Same as 'x' but go to insert mode at the end.
+
+    dd             Delete whole line by keeping the balanced state, i.e.
+                   keep the number of opening and closing parens the same.
+                   When preceded by a <count> value then delete this many
+                   lines.
+
+    <Leader>S      Same as 'dd' but go to insert mode at the end.
+
+    d{motion}      Delete text till {motion}. Keeps text balanced, so if the
+                   surrounded text contains unpaired matched characters then
+                   they are not removed.
+
+    c{motion}      Delete text till {motion} and start insert mode. Keeps text
+                   balanced just like d{motion}.
+
+    p              Put the text after the cursor with all unbalanced matched
+                   characters removed.
+
+    P              Put the text before the cursor with all unbalanced matched
+                   characters removed.
+
+
+Visual Mode:
+
+    (              Finds opening '(' of the current list and selects the whole
+                   list. Can be pressed repeatedly until the top level form
+                   selected.
+
+    )              Finds closing ')' of the current list and selects the whole
+                   list. Can be pressed repeatedly until the top level form
+                   selected.
+
+    d              Delete the current visual selection. Keeps text balanced,
+    x              so the the selection contains unpaired matched characters
+    <Del>          then they are not removed.
+
+    c              Delete the current visual selection and start insert mode.
+                   Keeps text balanced just like the 'd' command.
+
+    <Leader>W      Wrap the current visual selection in a pair of parentheses.
+    <Leader>w(     The visual selection is kept.
+
+    <Leader>w[     Wrap the current visual selection in a pair of square
+                   brackets. The visual selection is kept.
+
+    <Leader>w{     Wrap the current visual selection in a pair of curly braces.
+                   The visual selection is kept.
+
+    <Leader>w"     Wrap the current visual selection in a pair of double
+                   quotes. The visual selection is kept.
+
+
+Please note that if variable |g:paredit_shortmaps| is nonzero then the
+following normal mode mappings don't get a <Leader> prefix, they are mapped
+to existing (but infrequently used) Vim functions and instead the original Vim
+functions are mapped with the <Leader> prefix:
+
+                   <, >, J, O, W, S
+
+
+Vim has many built-in mappings for manipulating s-expressions. Here follows a
+list of useful commands, these are not defined by paredit.vim, they are
+available even when paredit mode is switched off.
+
+    %              Find the matching pair of the parenthesis the cursor is
+                   standing on.
+
+    d%             Delete till the matching parenthesis. Normally it is used
+                   when the cursor is standing on a parenthesis (works with
+                   square or curly braces as well). If not standing on a
+                   parenthesis then deletes left till the first opening paren,
+                   so this command may also be used to delete an s-expression
+                   that is right before the cursor.
+
+    daw            Delete a word. Can be used to delete a list element, the
+                   cursor may be placed anywhere in the element.
+
+    da(            Delete the innermost s-expression. The cursor may be placed
+                   anywhere inside the s-expression.
+
+    di(            Same as da( but does not delete the enclosing parens.
+
+
+===============================================================================
+PAREDIT OPTIONS                                               *paredit-options*
+
+|g:paredit_leader|           Custom <Leader> setting for Paredit.
+|g:paredit_matchlines|       Number of lines to look backward and forward
+                             when checking if the current form is balanced.
+
+|g:paredit_mode|             If nonzero, paredit mode is switched on.
+
+|g:paredit_shortmaps|        If nonzero, paredit is remapping some one-letter
+                             Vim commands that are not frequently used.
+
+
+                                                             *g:paredit_leader*
+This option allows a custom <Leader> setting for the Paredit keybindings.
+By default it has the same value as |mapleader|. If neither g:paredit_leader
+nor mapleader are defined then the default <Leader> is "," in Paredit.
+Example:
+    let g:paredit_leader = '\'
+If this is set in the .vimrc then Wrap will be mapped to \W instead of ,W.
+
+There is a separate |g:slimv_leader| option for the general Slimv keybindings.
+
+                                                         *g:paredit_matchlines*
+Number of lines to look backward and forward when checking if the current
+top level form is balanced in paredit mode. Default is 100.
+
+                                                               *g:paredit_mode*
+If nonzero then paredit mode is switched on, i.e. the plugin tries to keep the
+balanced state of parens. This is the default behaviour.
+
+                                                          *g:paredit_shortmaps*
+If nonzero, paredit is remapping some one-letter normal mode Vim commands that
+are not frequently used. These are <, >, J, O, W, S. The original function of
+these maps then can be reached via <Leader> (which is the "," character
+by default in Paredit).
+Otherwise these paredit functions can be reached via <Leader> maintaining the
+original functions of these keys.
+
+
+===============================================================================
+vim:tw=80:et:wrap:ft=help:norl:

File .vim/ftdetect/clojure.vim

+au BufNewFile,BufRead *.clj set filetype=clojure

File .vim/ftplugin/clojure.vim

+" Vim filetype plugin file
+" Language:     Clojure
+" Maintainer:   Meikel Brandmeyer <mb@kotka.de>
+
+" Only do this when not done yet for this buffer
+if exists("b:did_ftplugin")
+	finish
+endif
+
+let b:did_ftplugin = 1
+
+let s:cpo_save = &cpo
+set cpo&vim
+
+let b:undo_ftplugin = "setlocal fo< com< cms< cpt< isk< def<"
+
+setlocal iskeyword+=?,-,*,!,+,/,=,<,>,.,:
+
+setlocal define=^\\s*(def\\(-\\|n\\|n-\\|macro\\|struct\\|multi\\)?
+
+" Set 'formatoptions' to break comment lines but not other lines,
+" and insert the comment leader when hitting <CR> or using "o".
+setlocal formatoptions-=t formatoptions+=croql
+setlocal commentstring=;%s
+
+" Set 'comments' to format dashed lists in comments.
+setlocal comments=sO:;\ -,mO:;\ \ ,n:;
+
+" Take all directories of the CLOJURE_SOURCE_DIRS environment variable
+" and add them to the path option.
+if has("win32") || has("win64")
+	let s:delim = ";"
+else
+	let s:delim = ":"
+endif
+for dir in split($CLOJURE_SOURCE_DIRS, s:delim)
+	call vimclojure#AddPathToOption(dir . "/**", 'path')
+endfor
+
+" When the matchit plugin is loaded, this makes the % command skip parens and
+" braces in comments.
+let b:match_words = &matchpairs
+let b:match_skip = 's:comment\|string\|character'
+
+" Win32 can filter files in the browse dialog
+if has("gui_win32") && !exists("b:browsefilter")
+	let b:browsefilter = "Clojure Source Files (*.clj)\t*.clj\n" .
+				\ "Jave Source Files (*.java)\t*.java\n" .
+				\ "All Files (*.*)\t*.*\n"
+endif
+
+for ns in [ "clojure.core", "clojure.inspector", "clojure.java.browse",
+			\ "clojure.java.io", "clojure.java.javadoc", "clojure.java.shell",
+			\ "clojure.main", "clojure.pprint", "clojure.repl", "clojure.set",
+			\ "clojure.stacktrace", "clojure.string", "clojure.template",
+			\ "clojure.test", "clojure.test.tap", "clojure.test.junit",
+			\ "clojure.walk", "clojure.xml", "clojure.zip" ]
+	call vimclojure#AddCompletions(ns)
+endfor
+
+" Define toplevel folding if desired.
+function! ClojureGetFoldingLevelWorker() dict
+	execute self.lineno
+
+	if vimclojure#util#SynIdName() =~ 'clojureParen\d' && vimclojure#util#Yank('l', 'normal! "lyl') == '('
+		return 1
+	endif
+
+	if searchpairpos('(', '', ')', 'bWr', 'vimclojure#util#SynIdName() !~ "clojureParen\\d"') != [0, 0]
+		return 1
+	endif
+
+	return 0
+endfunction
+
+function! ClojureGetFoldingLevel(lineno)
+	let closure = {
+				\ 'lineno' : a:lineno,
+				\ 'f'      : function("ClojureGetFoldingLevelWorker")
+				\ }
+
+	return vimclojure#WithSavedPosition(closure)
+endfunction
+
+" Disabled for now. Too slow (and naive).
+if exists("g:clj_want_folding") && g:clj_want_folding == 1 && 0 == 1
+	setlocal foldexpr=ClojureGetFoldingLevel(v:lnum)
+	setlocal foldmethod=expr
+endif
+
+try
+	call vimclojure#InitBuffer()
+catch /.*/
+	" We swallow a failure here. It means most likely that the
+	" server is not running.
+	echohl WarningMsg
+	echomsg v:exception
+	echohl None
+endtry
+
+call vimclojure#MapPlug("n", "aw", "AddToLispWords")
+call vimclojure#MapPlug("n", "tr", "ToggleParenRainbow")
+
+call vimclojure#MapPlug("n", "lw", "DocLookupWord")
+call vimclojure#MapPlug("n", "li", "DocLookupInteractive")
+call vimclojure#MapPlug("n", "jw", "JavadocLookupWord")
+call vimclojure#MapPlug("n", "ji", "JavadocLookupInteractive")
+call vimclojure#MapPlug("n", "fd", "FindDoc")
+
+call vimclojure#MapPlug("n", "mw", "MetaLookupWord")
+call vimclojure#MapPlug("n", "mi", "MetaLookupInteractive")
+
+call vimclojure#MapPlug("n", "sw", "SourceLookupWord")
+call vimclojure#MapPlug("n", "si", "SourceLookupInteractive")
+
+call vimclojur