Meikel  Brandmeyer avatar Meikel Brandmeyer committed ffdd7f7 Merge

Merge v2.3.6

Comments (0)

Files changed (14)

File contents unchanged.

 3c4c4bc70e35280175aa9b60a2b438572619a692 v2.1.2
 d86f147b463088792300dc25a812a4ff43e604d6 v2.2.0
 b4e17e56720c6dd6ca8387dee533ad1fc05013d0 v2.3.0
+48f46bd4c412155583d7ac9b01101f8a2d73c24b v2.3.1
+05647d9e7583d7a9b9d0b6ccb4ba42cd6f535452 v2.3.2
+d26f07b8b7848a926225915586d3a5787b471069 v2.3.3
+4ecc0e347d34ab9e0a417c6305dcbab94b5f8b3d v2.3.4
+7e7dfc170071dd6adbbf8f7c299372a1751f5dab v2.3.5
+8a4568c55a5e825385d390e3f622e285d02a423c v2.3.6
 buildscript {
     repositories {
-        flatDir dirs: project(':').file('lib/build')
+        flatDir { dirs project(':').file('lib/build') }
     }
     dependencies {
-        classpath "clojuresque:clojuresque:1.5.0"
+        classpath "clojuresque:clojuresque:1.5.2"
         classpath "local-dotgradle:local-dotgradle:1.0.0"
     }
 }
 
 allprojects {
+    repositories {
+        flatDir { dirs project(':').file('lib/build') }
+    }
+
     ext.localDotGradle = project(':').file("local.gradle").absoluteFile
     apply plugin: 'local-dotgradle'
 }
     classpath = project.files(
         project(':server').sourceSets.main.clojure.srcDirs,
         project(':server').sourceSets.main.output.classesDir,
+        project(':server').sourceSets.main.output.resourcesDir,
         project(':server').sourceSets.main.compileClasspath
     )
 }
Add a comment to this file

gradle-plugin/src/main/groovy/vimclojure/gradle/VimClojurePlugin.groovy

File contents unchanged.

Add a comment to this file

lib/build/clojuresque-1.5.2.jar

Binary file added.

Add a comment to this file

lib/build/runtime-1.5.2.jar

Binary file added.

server/src/main/clojure/vimclojure/core.clj

 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 ; THE SOFTWARE.
 
-(ns vimclojure.core)
+(ns vimclojure.core
+  (:require
+    [clojure.java.io :as io]))
 
 (defn init-server
   []
-  ; Check for doc macro. 1.2 in c.core, 1.3 in c.repl
-  (when-not (ns-resolve 'clojure.core 'doc)
-    (binding [*ns* *ns*]
-      (in-ns 'user)
-      (refer-clojure)
-      (use 'clojure.repl))))
+  (binding [*ns* *ns*]
+    (in-ns 'user)
+    (refer-clojure)
+    ; Check for doc macro. 1.2 in c.core, 1.3 in c.repl
+    (when-not (ns-resolve 'clojure.core 'doc)
+      (use 'clojure.repl))
+    (when (io/resource "user.clj")
+      (load "user"))))

vim/src/main/vim/autoload/vimclojure.vim

 	let vimclojure#FuzzyIndent = 0
 endif
 
+if !exists("g:vimclojure#FuzzyIndentPatterns")
+	let vimclojure#FuzzyIndentPatterns = "with.*,def.*,let.*"
+endif
+
 if !exists("g:vimclojure#HighlightBuiltins")
 	if exists("g:clj_highlight_builtins")
 		call vimclojure#WarnDeprecated("g:clj_highlight_builtins",
 	let vimclojure#UseErrorBuffer = 1
 endif
 
+if !exists("g:vimclojure#SetupKeyMap")
+	let vimclojure#SetupKeyMap = 1
+endif
+
+if !exists("g:vimclojure#SearchThreshold")
+	let vimclojure#SearchThreshold = 100
+endif
+
 function! vimclojure#ReportError(msg)
 	if g:vimclojure#UseErrorBuffer
-		let buf = g:vimclojure#ResultBuffer.New()
+		let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
 		call buf.showText(a:msg)
 		wincmd p
 	else
 	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')
+				\ "level" : (a:toplevel ? "0" : '\d'),
+				\ "f"     : function("ClojureExtractSexprWorker")
 				\ }
 
-	function closure.f() 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
-
 	return vimclojure#util#WithSavedPosition(closure)
 endfunction
 
 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(\""
+	execute a:mode . "noremap <Plug>Clojure" . a:plug . "."
+				\ . " :<C-U>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("
+	execute a:mode . "noremap <Plug>Clojure" . a:plug . "."
+				\ . " :<C-U>call vimclojure#ProtectedPlug("
 				\ . " function(\"vimclojure#CommandPlug\"),"
 				\ . " [ function(\"" . a:f . "\"), [ " . a:args . " ]])<CR>"
 endfunction
 
 function! vimclojure#MapPlug(mode, keys, plug)
-	if !hasmapto("<Plug>Clojure" . a:plug, a:mode)
+	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
+					\ . " <Plug>Clojure" . a:plug . "."
 	endif
 endfunction
 
 
 function! vimclojure#Object.New(...) dict
 	let instance = copy(self)
+	let instance.prototype = self
 
 	call call(instance.Init, a:000, instance)
 
 endfunction
 
 let vimclojure#Buffer = copy(vimclojure#Object)
-let vimclojure#Buffer["__superObjectNew"] = vimclojure#Buffer["New"]
+let vimclojure#Buffer["__superObjectNew"]  = vimclojure#Buffer["New"]
+let vimclojure#Buffer["__superObjectInit"] = vimclojure#Buffer["Init"]
+
+let vimclojure#BufferNr = 0
 
 function! vimclojure#Buffer.New(...) dict
+	let nr = g:vimclojure#BufferNr
+	let bufname = printf("vimclojure_buffer_%06d", nr)
+	let g:vimclojure#BufferNr += 1
+
+	execute "badd" bufname
+	execute "buffer!" bufname
+
+	return call(self.__superObjectNew, a:000, self)
+endfunction
+
+function! vimclojure#Buffer.Init() dict
+	call self.__superObjectInit()
+	let self._buf = bufnr("%")
+endfunction
+
+function! vimclojure#Buffer.showText(text) dict
+	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.clear() dict
+	1
+	normal! "_dG
+endfunction
+
+function! vimclojure#Buffer.goHere() dict
+	if bufnr("%") != self._buf
+		execute "buffer!" self._buf
+	endif
+endfunction
+
+function! vimclojure#Buffer.close() dict
+	execute "bdelete!" self._buf
+endfunction
+
+let vimclojure#Window = copy(vimclojure#Object)
+let vimclojure#Window["__superObjectNew"] = vimclojure#Window["New"]
+let vimclojure#Window["__superObjectInit"] = vimclojure#Window["Init"]
+
+function! vimclojure#Window.New(...) dict
 	if g:vimclojure#SplitPos == "left" || g:vimclojure#SplitPos == "right"
 		let o_sr = &splitright
 		if g:vimclojure#SplitPos == "left"
 		else
 			set splitright
 		end
-		execute printf("%svnew", g:vimclojure#SplitSize)
+		execute printf("%svsplit", g:vimclojure#SplitSize)
 		let &splitright = o_sr
 	else
 		let o_sb = &splitbelow
 		else
 			set nosplitbelow
 		end
-		execute printf("%snew", g:vimclojure#SplitSize)
+		execute printf("%ssplit", 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("%")
+function! vimclojure#Window.Init(buftype) dict
+	call self.__superObjectInit()
+	let w:vimclojure_window = self
+	let self._buffer = a:buftype.New()
 endfunction
 
-function! vimclojure#Buffer.goHere() dict
-	execute "buffer! " . self._buffer
+function! vimclojure#Window.goHere() dict
+	let wn = self.findThis()
+	if wn == -1
+		echoerr 'A crisis has arisen! Cannot find my window.'
+	endif
+	execute wn . "wincmd w"
+	call self._buffer.goHere()
 endfunction
 
-function! vimclojure#Buffer.goHereWindow() dict
-	execute "sbuffer! " . self._buffer
-endfunction
-
-function! vimclojure#Buffer.resize() dict
+function! vimclojure#Window.resize() dict
 	call self.goHere()
 	let size = line("$")
 	if size < 3
 	execute "resize " . size
 endfunction
 
-function! vimclojure#Buffer.showText(text) dict
+function! vimclojure#Window.showText(text) dict
 	call self.goHere()
-	if type(a:text) == type("")
-		let text = split(a:text, '\n')
-	else
-		let text = a:text
-	endif
-	call append(line("$"), text)
+	call self._buffer.showText(a:text)
 endfunction
 
-function! vimclojure#Buffer.showOutput(output) dict
+function! vimclojure#Window.showOutput(output) dict
 	call self.goHere()
 	if a:output.value == 0
 		if a:output.stdout != ""
-			call self.showText(a:output.stdout)
+			call self._buffer.showText(a:output.stdout)
 		endif
 		if a:output.stderr != ""
-			call self.showText(a:output.stderr)
+			call self._buffer.showText(a:output.stderr)
 		endif
 	else
-		call self.showText(a:output.value)
+		call self._buffer.showText(a:output.value)
 	endif
 endfunction
 
-function! vimclojure#Buffer.clear() dict
-	1
-	normal! "_dG
+function! vimclojure#Window.clear() dict
+	call self.goHere()
+	call self._buffer.clear()
 endfunction
 
-function! vimclojure#Buffer.close() dict
-	execute "bdelete! " . self._buffer
+function! vimclojure#Window.close() dict
+	call self._buffer.close()
+endfunction
+
+function! vimclojure#Window.findThis() dict
+	for w in range(1, winnr("$"))
+		if type(getwinvar(w, "vimclojure_window")) == type({})
+			if getwinvar(w, "vimclojure_window") == self
+				return w
+			endif
+		endif
+	endfor
+
+	return -1
 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 = []
+let vimclojure#ResultWindow = copy(vimclojure#Window)
+let vimclojure#ResultWindow["__superWindowNew"]   = vimclojure#ResultWindow["New"]
+let vimclojure#ResultWindow["__superWindowClose"] = vimclojure#ResultWindow["close"]
 
-function! vimclojure#ResultBuffer.New(...) dict
-	if g:vimclojure#ResultBuffer.__instance != []
-		let closure = {
-					\ 'instance' : g:vimclojure#ResultBuffer.__instance[0],
-					\ 'args'     : a:000
-					\ }
-		function closure.f() dict
-			set switchbuf=useopen
-			call self.instance.goHereWindow()
-			call call(self.instance.Init, self.args, self.instance)
+function! vimclojure#ResultWindow.New(buftype, ...) dict
+	if exists("t:vimclojure_result_window")
+		call t:vimclojure_result_window.goHere()
 
-			return self.instance
-		endfunction
+		if t:vimclojure_result_window._buffer.prototype != a:buftype
+			let t:vimclojure_result_window._buffer = a:buftype.New()
+		else
+			call t:vimclojure_result_window.clear()
+		endif
 
-		return vimclojure#util#WithSavedOption('switchbuf', closure)
+		return t:vimclojure_result_window
 	endif
 
+	let instance = call(self.__superWindowNew, [a:buftype] + a:000, self)
 	let b:vimclojure_result_buffer = 1
-	let instance = call(self.__superBufferNew, a:000, self)
-	let g:vimclojure#ResultBuffer.__instance = [ instance ]
+	let t:vimclojure_result_window = instance
 
 	return instance
 endfunction
 
+function! vimclojure#ResultWindow.close() dict
+	unlet t:vimclojure_result_window
+	call self.__superWindowClose()
+endfunction
+
+function! vimclojure#ResultWindow.CloseWindow() dict
+	if exists("t:vimclojure_result_window")
+		call t:vimclojure_result_window.close()
+	endif
+endfunction
+
+"function! s:InvalidateResultBufferIfNecessary(buf)
+"	" FIXME: This is incorrect.
+"	if exists("t:vimclojure_result_window")
+"				\ && t:vimclojure_result_window._buffer._buf == a:buf
+"		let t:vimclojure_result_window.close()
+"	endif
+"endfunction
+
+"augroup VimClojureResultWindow
+"	au BufDelete * call s:InvalidateResultWindowIfNecessary(expand("<abuf>"))
+"augroup END
+
+let vimclojure#ResultBuffer = copy(vimclojure#Buffer)
+let vimclojure#ResultBuffer["__superBufferInit"]  = vimclojure#ResultBuffer.Init
+let vimclojure#ResultBuffer["__superBufferClear"] = vimclojure#ResultBuffer.clear
+
 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()
+endfunction
+
+function! vimclojure#ResultBuffer.clear() dict
+	call self.__superBufferClear()
 	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"]
+let vimclojure#ClojureResultBuffer["__superResultBufferShowText"] =
+			\ vimclojure#ResultBuffer["showText"]
 
-function! vimclojure#ClojureResultBuffer.Init(ns) dict
+function! vimclojure#ClojureResultBuffer.Init(...) dict
 	call self.__superResultBufferInit()
-	set filetype=clojure
-	let b:vimclojure_namespace = a:ns
+	set filetype=vimclojure.clojure
+	if a:0 == 1
+		let b:vimclojure_namespace = a:1
+	else
+		let b:vimclojure_namespace = "user"
+	endif
 endfunction
 
-function! vimclojure#ClojureResultBuffer.showOutput(text) dict
-	call self.__superResultBufferShowOutput(a:text)
+function! vimclojure#ClojureResultBuffer.showText(text) dict
+	call self.__superResultBufferShowText(a:text)
 	normal G
 endfunction
 
+function! vimclojure#ShellEscapeArguments(vals)
+	let closure = {
+				\ 'vals': a:vals,
+				\ 'f'   : function("ClojureShellEscapeArgumentsWorker")
+				\ }
+
+function! vimclojure#ShowResult(result)
+	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ResultBuffer)
+	call buf.showOutput(a:result)
+	wincmd p
+endfunction
+
+function! vimclojure#ShowClojureResult(result, nspace)
+	let buf = g:vimclojure#ResultWindow.New(g:vimclojure#ClojureResultBuffer)
+	let b:vimclojure_namespace = a:nspace
+	call buf.showOutput(a:result)
+	wincmd p
+endfunction
+
 function! vimclojure#DocLookup(word)
 	if a:word == ""
 		return
 
 	let doc = g:vimclojure#Connector.execute("DocLookup",
 				\ "-n", b:vimclojure_namespace, a:word)
-	let buf = g:vimclojure#ResultBuffer.New()
-	call buf.showOutput(doc)
-	wincmd p
+	call vimclojure#ShowResult(doc)
 endfunction
 
 function! vimclojure#FindDoc()
 	let pattern = input("Pattern to look for: ")
 	let doc = g:vimclojure#Connector.execute("FindDoc", pattern)
-	let buf = g:vimclojure#ResultBuffer.New()
-	call buf.showOutput(doc)
-	wincmd p
+	call vimclojure#ShowResult(doc)
 endfunction
 
 let s:DefaultJavadocPaths = {
 				\ "-n", b:vimclojure_namespace, word)
 
 	if path.stderr != ""
-		let buf = g:vimclojure#ResultBuffer.New()
-		call buf.showOutput(path)
-		wincmd p
+		call vimclojure#ShowResult(path)
 		return
 	endif
 
 function! vimclojure#SourceLookup(word)
 	let source = g:vimclojure#Connector.execute("SourceLookup",
 				\ "-n", b:vimclojure_namespace, a:word)
-	let buf = g:vimclojure#ClojureResultBuffer.New(b:vimclojure_namespace)
-	call buf.showOutput(source)
-	wincmd p
+	call vimclojure#ShowClojureResult(source, b:vimclojure_namespace)
 endfunction
 
 function! vimclojure#MetaLookup(word)
 	let meta = g:vimclojure#Connector.execute("MetaLookup",
 				\ "-n", b:vimclojure_namespace, a:word)
-	let buf = g:vimclojure#ClojureResultBuffer.New(b:vimclojure_namespace)
-	call buf.showOutput(meta)
-	wincmd p
+	call vimclojure#ShowClojureResult(meta, b:vimclojure_namespace)
 endfunction
 
 function! vimclojure#GotoSource(word)
 				\ "-n", b:vimclojure_namespace, a:word)
 
 	if pos.stderr != ""
-		let buf = g:vimclojure#ResultBuffer.New()
-		call buf.showOutput(pos)
-		wincmd p
+		call vimclojure#ShowResult(pos)
 		return
 	endif
 
 
 	let expanded = call(g:vimclojure#Connector.execute, cmd)
 
-	let buf = g:vimclojure#ClojureResultBuffer.New(ns)
-	call buf.showOutput(expanded)
-	wincmd p
+	call vimclojure#ShowClojureResult(expanded, ns)
 endfunction
 
 function! vimclojure#RequireFile(all)
 	let require = "(require :reload" . all . " :verbose '". ns. ")"
 	let result = g:vimclojure#Connector.execute("Repl", "-r", require)
 
-	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#RunTests(all)
 
 	let result = call(g:vimclojure#Connector.execute,
 				\ [ "RunTests", "-n", ns ] + (a:all ? [ "-a" ] : []))
-	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
-	call resultBuffer.showOutput(result)
-	wincmd p
+
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalFile()
 	let result = g:vimclojure#Connector.execute("Repl",
 				\ "-r", "-n", ns, "-f", file, content)
 
-	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalLine()
 	let result = g:vimclojure#Connector.execute("Repl",
 				\ "-r", "-n", ns, "-f", file, "-l", theLine, content)
 
-	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalBlock()
 	let file = vimclojure#BufferName()
 	let ns = b:vimclojure_namespace
 
-	let content = getbufline(bufnr("%"), line("'<"), line("'>"))
+	let content = vimclojure#util#Yank("l", 'normal! gv"ly')
 	let result = g:vimclojure#Connector.execute("Repl",
 				\ "-r", "-n", ns, "-f", file, "-l", line("'<") - 1, content)
 
-	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 endfunction
 
 function! vimclojure#EvalToplevel()
 	let result = g:vimclojure#Connector.execute("Repl",
 				\ "-r", "-n", ns, "-f", file, "-l", pos[0] - 1, expr)
 
-	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
+endfunction
+
+function! ClojureEvalParagraphWorker() dict
+	normal! }
+	return line(".")
 endfunction
 
 function! vimclojure#EvalParagraph()
 	let ns = b:vimclojure_namespace
 	let startPosition = line(".")
 
-	let closure = {}
-
-	function! closure.f() dict
-		normal! }
-		return line(".")
-	endfunction
+	let closure = { 'f' : function("ClojureEvalParagraphWorker") }
 
 	let endPosition = vimclojure#util#WithSavedPosition(closure)
 
 	let result = g:vimclojure#Connector.execute("Repl",
 				\ "-r", "-n", ns, "-f", file, "-l", startPosition - 1, content)
 
-	let resultBuffer = g:vimclojure#ClojureResultBuffer.New(ns)
-	call resultBuffer.showOutput(result)
-	wincmd p
+	call vimclojure#ShowClojureResult(result, ns)
 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 = copy(vimclojure#Window)
+let vimclojure#Repl["__superWindowNew"]   = vimclojure#Repl.New
+let vimclojure#Repl["__superWindowInit"]  = vimclojure#Repl.Init
+let vimclojure#Repl["__superWindowClear"] = vimclojure#Repl.clear
 
 let vimclojure#Repl._history = []
 let vimclojure#Repl._historyDepth = 0
 
 " 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
+function! vimclojure#Repl.New(namespace, ...) dict
 	let replStart = g:vimclojure#Connector.execute("Repl", "-s",
 				\ "-n", a:namespace)
 	if replStart.stderr != ""
 		return
 	endif
 
-	let instance = call(self.__superBufferNew, [a:namespace], self)
+	let instance = call(self.__superWindowNew,
+				\ [g:vimclojure#Buffer, a:namespace] + a:000,
+				\ self)
 	let instance._id = replStart.value.id
 	call g:vimclojure#Connector.execute("Repl",
 				\ "-r", "-i", instance._id, "(require 'clojure.stacktrace)")
 	return instance
 endfunction
 
-function! vimclojure#Repl.Init(namespace) dict
-	call self.__superBufferInit()
+function! vimclojure#Repl.Init(buftype, namespace) dict
+	call self.__superWindowInit(a:buftype)
 
 	let self._prompt = a:namespace . "=>"
 
 
 	let b:vimclojure_repl = self
 
-	set filetype=clojure
+	set filetype=vimclojure.clojure
 	let b:vimclojure_namespace = a:namespace
 
-	if !hasmapto("<Plug>ClojureReplEnterHook", "i")
-		imap <buffer> <silent> <CR> <Plug>ClojureReplEnterHook
+	if !hasmapto("<Plug>ClojureReplEnterHook.", "i")
+		imap <buffer> <silent> <CR> <Plug>ClojureReplEnterHook.
 	endif
-	if !hasmapto("<Plug>ClojureReplEvaluate", "i")
-		imap <buffer> <silent> <C-CR> <Plug>ClojureReplEvaluate
+	if !hasmapto("<Plug>ClojureReplEvaluate.", "i")
+		imap <buffer> <silent> <C-CR> <Plug>ClojureReplEvaluate.
 	endif
-	if !hasmapto("<Plug>ClojureReplHatHook", "n")
-		nmap <buffer> <silent> ^ <Plug>ClojureReplHatHook
+	if !hasmapto("<Plug>ClojureReplHatHook.", "n")
+		nmap <buffer> <silent> ^ <Plug>ClojureReplHatHook.
 	endif
-	if !hasmapto("<Plug>ClojureReplUpHistory", "i")
-		imap <buffer> <silent> <C-Up> <Plug>ClojureReplUpHistory
+	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
+	if !hasmapto("<Plug>ClojureReplDownHistory.", "i")
+		imap <buffer> <silent> <C-Down> <Plug>ClojureReplDownHistory.
 	endif
 
 	normal! G
 	startinsert!
 endfunction
 
+function! vimclojure#Repl.clear() dict
+	call self.__superWindowClear()
+	call self.showPrompt()
+endfunction
+
 function! vimclojure#Repl.getCommand() dict
 	let ln = line("$")
 
 	if result.value == 0 && result.stderr == ""
 		call vimclojure#ReplDoEnter()
 	elseif result.stderr != ""
-		let buf = g:vimclojure#ResultBuffer.New()
-		call buf.showOutput(result)
+		call vimclojure#ShowResult(result)
 	else
 		let result = g:vimclojure#Connector.execute("Repl",
 					\ "-r", "-i", self._id, cmd)

vim/src/main/vim/autoload/vimclojure/util.vim

 	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)
-	function a:closure.save() dict
-		let [ _b, l, c, _o ] = getpos(".")
-		let b = bufnr("%")
-		return [b, l, c]
-	endfunction
-
-	function a:closure.restore(value) dict
-		let [b, l, c] = a:value
-
-		if bufnr("%") != b
-			execute b "buffer!"
-		endif
-		call setpos(".", [0, l, c, 0])
-	endfunction
+	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
-
-	function a:closure.save() dict
-		return [getreg(self._register, 1), getregtype(self._register)]
-	endfunction
-
-	function a:closure.restore(value) dict
-		call call(function("setreg"), [self._register] + a:value)
-	endfunction
+	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
-
-	function a:closure.save() dict
-		return eval("&" . self._option)
-	endfunction
-
-	function a:closure.restore(value) dict
-		execute "let &" . self._option . " = a:value"
-	endfunction
+	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}
-
-	function closure.f() dict
-		silent execute self.yank
-		return getreg(self.reg)
-	endfunction
+	let closure = {
+				\ 'reg': a:r,
+				\ 'yank': a:how,
+				\ 'f': function("s:DoYank")
+				\ }
 
 	return vimclojure#util#WithSavedRegister(a:r, closure)
 endfunction

vim/src/main/vim/doc/clojure.txt

 pattern like "defsomething" or "with-something".
 
 By setting the fuzzy indent option, you can tell VimClojure, that you
-want names beginning in "def" or "with" to be indented as if they
+want names matching a fuzzy indent pattern to be indented as if they
 were included in the 'lispwords' option.
 >
         let vimclojure#FuzzyIndent = 1
 <
 This option is disabled by default.
 
+Custom fuzzy indent patterns may be specified as normal regular expressions
+in the corresponding option. The patterns are matched against the leading
+symbol of the form in a way to ignore namespace aliases. The default
+patterns are “def.*”, “with.*” and “let.*”.
+
+For example, consider working a lot with core.logic. Then you may specify
+eg. “fresh” in .vim/after/ftplugin/clojure.vim.
+>
+        let vimclojure#FuzzyIndentPatterns .= ",fresh"
+<
+Note: this is a normal variable. So you have to use “.=” rather than
+“+=” and the comma separator has to be given explicitly.
+
+To be able to properly indent a given line there is some searching
+necessary to determine the surroundings of the cursor. In big files
+this my result in a slow down when entering a new line. So there is
+an option to basically limit the horizon which is searched for the
+indentation to synchronise. By default this is 100 lines backwards in
+the file. However you may specify whatever value works best for you.
+Higher values mean more searching.
+>
+        let vimclojure#SearchThreshold = 100
+<
+
 Preview Window
 --------------
 
 under the |maplocalleader| help topic.
 
 You can redefine any key mapping using some autocommand in your .vimrc file.
-All mappings use so-called Plugs. Simply prepend <Plug>Clojure to the given
-Plug name and your setting will override the default mapping.
+All mappings use so-called Plugs. Simply prepend "<Plug>Clojure" to the given
+Plug name, append a "." and your setting will override the default mapping.
 >
-        aucmd BufRead,BufNewFile *.clj nmap xyz <Plug>ClojureEvalToplevel
+        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
                         Require the namespace of the current file with
                         the :reload flag. Note: For this to work with
                         a remote Clojure server, the files have to put in
-                        place before issueing the command, eg. via scp
+                        place before issuing the command, eg. via scp
                         or NFS.
 
 <LocalLeader>rF                                 *rF* *RequireFileAll*
                         Require the namespace of the current file with
                         the :reload-all flag. Note: For this to work with
                         a remote Clojure server, the files have to put in
-                        place before issueing the command, eg. via scp
+                        place before issuing the command, eg. via scp
                         or NFS.
 
 <LocalLeader>rt                                 *rt* *RunTests*
                         to run the tests of the namespace via run-tests.
                         Note: For this to work with a remote Clojure
                         server, the files have to put in place before
-                        issueing the command, eg. via scp or NFS.
+                        issuing the command, eg. via scp or NFS.
 
 <LocalLeader>me                                 *me* *MacroExpand*
                         Expand the innermost sexpression currently
 the end of the prompt and to the beginning of the line.
 
 The Plugs are:
- - <Plug>ClojureReplEnterHook for the enter key
- - <Plug>ClojureReplEvaluate for immediate evaluation (<C-CR>)
- - <Plug>ClojureReplHatHook for ^ navigation
- - <Plug>ClojureReplUpHistory for going backwards in history (<C-Up>)
- - <Plug>ClojureReplDownHistory for going forwards in history (<C-Down>)
+ - <Plug>ClojureReplEnterHook. for the enter key
+ - <Plug>ClojureReplEvaluate. for immediate evaluation (<C-CR>)
+ - <Plug>ClojureReplHatHook. for ^ navigation
+ - <Plug>ClojureReplUpHistory. for going backwards in history (<C-Up>)
+ - <Plug>ClojureReplDownHistory. for going forwards in history (<C-Down>)
 
 The following convenience commands are provided:
 

vim/src/main/vim/ftplugin/clojure.vim

 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 }
-
-	function closure.f() 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
+	let closure = {
+				\ 'lineno' : a:lineno,
+				\ 'f'      : function("ClojureGetFoldingLevelWorker")
+				\ }
 
 	return vimclojure#WithSavedPosition(closure)
 endfunction
 	setlocal omnifunc=vimclojure#OmniCompletion
 
 	augroup VimClojure
+		au!
 		autocmd CursorMovedI <buffer> if pumvisible() == 0 | pclose | endif
 	augroup END
 endif

vim/src/main/vim/indent/clojure.vim

 function! s:MatchPairs(open, close, stopat)
 	" Stop only on vector and map [ resp. {. Ignore the ones in strings and
 	" comments.
-	return searchpairpos(a:open, '', a:close, 'bWn',
+	if a:stopat == 0
+		let stopat = max([line(".") - g:vimclojure#SearchThreshold, 0])
+	else
+		let stopat = a:stopat
+	endif
+
+	let pos = searchpairpos(a:open, '', a:close, 'bWn',
 				\ 'vimclojure#util#SynIdName() !~ "clojureParen\\d"',
-				\ a:stopat)
+				\ stopat)
+	return [ pos[0], virtcol(pos) ]
+endfunction
+
+function! ClojureCheckForStringWorker() dict
+	" Check whether there is the last character of the previous line is
+	" highlighted as a string. If so, we check whether it's a ". In this
+	" case we have to check also the previous character. The " might be the
+	" closing one. In case the we are still in the string, we search for the
+	" opening ". If this is not found we take the indent of the line.
+	let nb = prevnonblank(v:lnum - 1)
+
+	if nb == 0
+		return -1
+	endif
+
+	call cursor(nb, 0)
+	call cursor(0, col("$") - 1)
+	if vimclojure#util#SynIdName() != "clojureString"
+		return -1
+	endif
+
+	" This will not work for a " in the first column...
+	if vimclojure#util#Yank('l', 'normal! "lyl') == '"'
+		call cursor(0, col("$") - 2)
+		if vimclojure#util#SynIdName() != "clojureString"
+			return -1
+		endif
+		if vimclojure#util#Yank('l', 'normal! "lyl') != '\\'
+			return -1
+		endif
+		call cursor(0, col("$") - 1)
+	endif
+
+	let p = searchpos('\(^\|[^\\]\)\zs"', 'bW')
+
+	if p != [0, 0]
+		return p[1] - 1
+	endif
+
+	return indent(".")
 endfunction
 
 function! s:CheckForString()
-	let closure = {}
+	return vimclojure#util#WithSavedPosition({
+				\ 'f' : function("ClojureCheckForStringWorker")
+				\ })
+endfunction
 
-	function closure.f() dict
-		" Check whether there is the last character of the previous line is
-		" highlighted as a string. If so, we check whether it's a ". In this
-		" case we have to check also the previous character. The " might be the
-		" closing one. In case the we are still in the string, we search for the
-		" opening ". If this is not found we take the indent of the line.
-		let nb = prevnonblank(v:lnum - 1)
+function! ClojureIsMethodSpecialCaseWorker() dict
+	" Find the next enclosing form.
+	call vimclojure#util#MoveBackward()
 
-		if nb == 0
-			return -1
-		endif
+	" Special case: we are at a '(('.
+	if vimclojure#util#Yank('l', 'normal! "lyl') == '('
+		return 0
+	endif
+	call cursor(self.pos)
 
-		call cursor(nb, 0)
-		call cursor(0, col("$") - 1)
-		if vimclojure#util#SynIdName() != "clojureString"
-			return -1
-		endif
+	let nextParen = s:MatchPairs('(', ')', 0)
 
-		" This will not work for a " in the first column...
-		if vimclojure#util#Yank('l', 'normal! "lyl') == '"'
-			call cursor(0, col("$") - 2)
-			if vimclojure#util#SynIdName() != "clojureString"
-				return -1
-			endif
-			if vimclojure#util#Yank('l', 'normal! "lyl') != '\\'
-				return -1
-			endif
-			call cursor(0, col("$") - 1)
-		endif
+	" Special case: we are now at toplevel.
+	if nextParen == [0, 0]
+		return 0
+	endif
+	call cursor(nextParen)
 
-		let p = searchpos('\(^\|[^\\]\)\zs"', 'bW')
+	call vimclojure#util#MoveForward()
+	let keyword = vimclojure#util#Yank('l', 'normal! "lye')
+	if index([ 'deftype', 'defrecord', 'reify', 'proxy',
+				\ 'extend-type', 'extend-protocol',
+				\ 'letfn' ], keyword) >= 0
+		return 1
+	endif
 
-		if p != [0, 0]
-			return p[1] - 1
-		endif
-
-		return indent(".")
-	endfunction
-
-	return vimclojure#util#WithSavedPosition(closure)
+	return 0
 endfunction
 
 function! s:IsMethodSpecialCase(position)
-	let closure = { 'pos': a:position }
-
-	function closure.f() dict
-		" Find the next enclosing form.
-		call vimclojure#util#MoveBackward()
-
-		" Special case: we are at a '(('.
-		if vimclojure#util#Yank('l', 'normal! "lyl') == '('
-			return 0
-		endif
-		call cursor(self.pos)
-
-		let nextParen = s:MatchPairs('(', ')', 0)
-
-		" Special case: we are now at toplevel.
-		if nextParen == [0, 0]
-			return 0
-		endif
-		call cursor(nextParen)
-
-		call vimclojure#util#MoveForward()
-		let keyword = vimclojure#util#Yank('l', 'normal! "lye')
-		if index([ 'deftype', 'defrecord', 'reify', 'proxy',
-					\ 'extend', 'extend-type', 'extend-protocol',
-					\ 'letfn' ], keyword) >= 0
-			return 1
-		endif
-
-		return 0
-	endfunction
+	let closure = {
+				\ 'pos': a:position,
+				\ 'f' : function("ClojureIsMethodSpecialCaseWorker")
+				\ }
 
 	return vimclojure#util#WithSavedPosition(closure)
 endfunction
 		return paren[1] + &shiftwidth - 1
 	endif
 
-	if g:vimclojure#FuzzyIndent && w =~ '\(^\|/\)\(def\|with\)'
-		return paren[1] + &shiftwidth - 1
+	" XXX: Slight glitch here with special cases. However it's only
+	" a heureustic. Offline we can't do more.
+	if g:vimclojure#FuzzyIndent
+				\ && w != 'with-meta'
+				\ && w != 'clojure.core/with-meta'
+		for pat in split(g:vimclojure#FuzzyIndentPatterns, ",")
+			if w =~ '\(^\|/\)' . pat . '$'
+						\ && w !~ '\(^\|/\)' . pat . '\*$'
+						\ && w !~ '\(^\|/\)' . pat . '-fn$'
+				return paren[1] + &shiftwidth - 1
+			endif
+		endfor
 	endif
 
 	normal! w
 	endif
 
 	normal! ge
-	return col(".") + 1
+	return virtcol(".") + 1
 endfunction
 
 setlocal indentexpr=GetClojureIndent()

vim/src/main/vim/plugin/clojure.vim

 call vimclojure#MakeCommandPlug("n", "StartRepl", "vimclojure#StartRepl", "")
 call vimclojure#MakeCommandPlug("n", "StartLocalRepl", "vimclojure#StartRepl", "b:vimclojure_namespace")
 
-inoremap <Plug>ClojureReplEnterHook <Esc>:call b:vimclojure_repl.enterHook()<CR>
-inoremap <Plug>ClojureReplEvaluate <Esc>G$:call b:vimclojure_repl.enterHook()<CR>
-nnoremap <Plug>ClojureReplHatHook :call b:vimclojure_repl.hatHook()<CR>
-inoremap <Plug>ClojureReplUpHistory <C-O>:call b:vimclojure_repl.upHistory()<CR>
-inoremap <Plug>ClojureReplDownHistory <C-O>:call b:vimclojure_repl.downHistory()<CR>
+inoremap <Plug>ClojureReplEnterHook. <Esc>:call b:vimclojure_repl.enterHook()<CR>
+inoremap <Plug>ClojureReplEvaluate. <Esc>G$:call b:vimclojure_repl.enterHook()<CR>
+nnoremap <Plug>ClojureReplHatHook. :call b:vimclojure_repl.hatHook()<CR>
+inoremap <Plug>ClojureReplUpHistory. <C-O>:call b:vimclojure_repl.upHistory()<CR>
+inoremap <Plug>ClojureReplDownHistory. <C-O>:call b:vimclojure_repl.downHistory()<CR>
 
-nnoremap <Plug>ClojureCloseResultBuffer :call vimclojure#ResultBuffer.CloseBuffer()<CR>
+nnoremap <Plug>ClojureCloseResultBuffer. :call vimclojure#ResultWindow.CloseWindow()<CR>
 
 let &cpo = s:cpo_save

vim/src/main/vim/syntax/clojure.vim

 		\            . "eval find-doc file-seq flush hash load load-file "
 		\            . "read read-line scan slurp subs sync test "
 		\            . "format printf loaded-libs use require load-reader "
-		\            . "load-string + +' -' *' /' < <= == >= > dec dec' "
+		\            . "load-string + - * / +' -' *' /' < <= == >= > dec dec' "
 		\            . "inc inc' min max "
 		\            . "neg? pos? quot rem zero? rand rand-int decimal? even? "
 		\            . "odd? float? integer? number? ratio? rational? "
 syn keyword clojureTodo contained FIXME XXX TODO FIXME: XXX: TODO:
 syn match   clojureComment contains=clojureTodo ";.*$"
 
-syn match   clojureKeyword "\c:\{1,2}[a-z?!\-_+*./=<>#$][a-z0-9?!\-_+*\./=<>#$]*"
+syn match   clojureKeyword "\c:\{1,2}[a-z0-9?!\-_+*.=<>#$]\+\(/[a-z0-9?!\-_+*.=<>#$]\+\)\?"
 
 syn region  clojureString start=/L\="/ skip=/\\\\\|\\"/ end=/"/
 
 syn match   clojureQuote "\('\|`\)"
 syn match   clojureUnquote "\(\~@\|\~\)"
 syn match   clojureDispatch "\(#^\|#'\)"
+syn match   clojureDispatch "\^"
 
 syn match   clojureAnonArg contained "%\(\d\|&\)\?"
 syn match   clojureVarArg contained "&"
 
 syn region  clojurePattern start=/L\=\#"/ skip=/\\\\\|\\"/ end=/"/
 
-syn region  clojureCommentSexp                          start="("                                       end=")" transparent contained contains=clojureCommentSexp
-syn region  clojureComment     matchgroup=clojureParen0 start="(comment"rs=s+1 matchgroup=clojureParen0 end=")"                       contains=clojureCommentSexp
-syn region  clojureComment                              start="#!" end="\n"
+" FIXME: Matching of 'comment' is broken. It seems we can't nest
+" the different highlighting items, when they share the same end
+" pattern.
+" See also: https://bitbucket.org/kotarak/vimclojure/issue/87/comment-is-highlighted-incorrectly
+"
+"syn region  clojureCommentSexp                          start="("                                       end=")" transparent contained contains=clojureCommentSexp
+"syn region  clojureComment     matchgroup=clojureParen0 start="(comment"rs=s+1 matchgroup=clojureParen0 end=")"                       contains=clojureTopCluster
+syn match   clojureComment "comment"
+syn region  clojureComment start="#!" end="\n"
 syn match   clojureComment "#_"
 
 syn sync fromstart
 	call VimClojureSetupParenRainbow()
 
 	augroup VimClojureSyntax
+		au!
 		autocmd ColorScheme * if &ft == "clojure" | call VimClojureSetupParenRainbow() | endif
 	augroup END
 else
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.