Commits

Meikel Brandmeyer  committed c090067

Completed the Big Merge

  • Participants
  • Parent commits 16c464b

Comments (0)

Files changed (21)

-Gorilla itself, excluding the repl-ln, is licensed under the MIT license
-as follows:
-
-Copyright 2008 (c) Meikel Brandmeyer.
+Copyright 2008,2009 (c) Meikel Brandmeyer.
 All rights reserved.
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 THE SOFTWARE.
-
--------------------------------------------------------------------------------
-
-The code of the repl-ln is taken from Clojure Contrib and is copyright
-by Stephen C. Gilardi. It is licensed under the CPL as follows:
-
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
-LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
-CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
-1. DEFINITIONS
-
-"Contribution" means:
-
-a) in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and
-
-b) in the case of each subsequent Contributor:
-
-i) changes to the Program, and
-
-ii) additions to the Program;
-
-where such changes and/or additions to the Program originate from and are
-distributed by that particular Contributor. A Contribution 'originates' from a
-Contributor if it was added to the Program by such Contributor itself or
-anyone acting on such Contributor's behalf. Contributions do not include
-additions to the Program which: (i) are separate modules of software
-distributed in conjunction with the Program under their own license agreement,
-and (ii) are not derivative works of the Program.
-
-"Contributor" means any person or entity that distributes the Program.
-
-"Licensed Patents " mean patent claims licensable by a Contributor which are
-necessarily infringed by the use or sale of its Contribution alone or when
-combined with the Program.
-
-"Program" means the Contributions distributed in accordance with this
-Agreement.
-
-"Recipient" means anyone who receives the Program under this Agreement,
-including all Contributors.
-
-2. GRANT OF RIGHTS
-
-a) Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide, royalty-free copyright license to
-reproduce, prepare derivative works of, publicly display, publicly perform,
-distribute and sublicense the Contribution of such Contributor, if any, and
-such derivative works, in source code and object code form.
-
-b) Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide, royalty-free patent license under
-Licensed Patents to make, use, sell, offer to sell, import and otherwise
-transfer the Contribution of such Contributor, if any, in source code and
-object code form.  This patent license shall apply to the combination of the
-Contribution and the Program if, at the time the Contribution is added by the
-Contributor, such addition of the Contribution causes such combination to be
-covered by the Licensed Patents. The patent license shall not apply to any
-other combinations which include the Contribution. No hardware per se is
-licensed hereunder.
-
-c) Recipient understands that although each Contributor grants the licenses to
-its Contributions set forth herein, no assurances are provided by any
-Contributor that the Program does not infringe the patent or other
-intellectual property rights of any other entity. Each Contributor disclaims
-any liability to Recipient for claims brought by any other entity based on
-infringement of intellectual property rights or otherwise. As a condition to
-exercising the rights and licenses granted hereunder, each Recipient hereby
-assumes sole responsibility to secure any other intellectual property rights
-needed, if any.  For example, if a third party patent license is required to
-allow Recipient to distribute the Program, it is Recipient's responsibility to
-acquire that license before distributing the Program.
-
-d) Each Contributor represents that to its knowledge it has sufficient
-copyright rights in its Contribution, if any, to grant the copyright license
-set forth in this Agreement.
-
-3. REQUIREMENTS
-
-A Contributor may choose to distribute the Program in object code form under
-its own license agreement, provided that:
-
-a) it complies with the terms and conditions of this Agreement; and
-
-b) its license agreement:
-
-i) effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose;
-
-ii) effectively excludes on behalf of all Contributors all liability for
-damages, including direct, indirect, special, incidental and consequential
-damages, such as lost profits;
-
-iii) states that any provisions which differ from this Agreement are offered
-by that Contributor alone and not by any other party; and
-
-iv) states that source code for the Program is available from such
-Contributor, and informs licensees how to obtain it in a reasonable manner on
-or through a medium customarily used for software exchange.
-
-When the Program is made available in source code form:
-
-a) it must be made available under this Agreement; and
-
-b) a copy of this Agreement must be included with each copy of the Program.
-
-Contributors may not remove or alter any copyright notices contained within
-the Program.
-
-Each Contributor must identify itself as the originator of its Contribution,
-if any, in a manner that reasonably allows subsequent Recipients to identify
-the originator of the Contribution.
-
-4. COMMERCIAL DISTRIBUTION
-
-Commercial distributors of software may accept certain responsibilities with
-respect to end users, business partners and the like. While this license is
-intended to facilitate the commercial use of the Program, the Contributor who
-includes the Program in a commercial product offering should do so in a manner
-which does not create potential liability for other Contributors. Therefore,
-if a Contributor includes the Program in a commercial product offering, such
-Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
-every other Contributor ("Indemnified Contributor") against any losses,
-damages and costs (collectively "Losses") arising from claims, lawsuits and
-other legal actions brought by a third party against the Indemnified
-Contributor to the extent caused by the acts or omissions of such Commercial
-Contributor in connection with its distribution of the Program in a commercial
-product offering. The obligations in this section do not apply to any claims
-or Losses relating to any actual or alleged intellectual property
-infringement. In order to qualify, an Indemnified Contributor must: a)
-promptly notify the Commercial Contributor in writing of such claim, and b)
-allow the Commercial Contributor to control, and cooperate with the Commercial
-Contributor in, the defense and any related settlement negotiations. The
-Indemnified Contributor may participate in any such claim at its own expense.
-
-For example, a Contributor might include the Program in a commercial product
-offering, Product X. That Contributor is then a Commercial Contributor. If
-that Commercial Contributor then makes performance claims, or offers
-warranties related to Product X, those performance claims and warranties are
-such Commercial Contributor's responsibility alone. Under this section, the
-Commercial Contributor would have to defend claims against the other
-Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.
-
-5. NO WARRANTY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
-IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
-Recipient is solely responsible for determining the appropriateness of using
-and distributing the Program and assumes all risks associated with its
-exercise of rights under this Agreement, including but not limited to the
-risks and costs of program errors, compliance with applicable laws, damage to
-or loss of data, programs or equipment, and unavailability or interruption of
-operations.
-
-6. DISCLAIMER OF LIABILITY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
-CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
-LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
-EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGES.
-
-7. GENERAL
-
-If any provision of this Agreement is invalid or unenforceable under
-applicable law, it shall not affect the validity or enforceability of the
-remainder of the terms of this Agreement, and without further action by the
-parties hereto, such provision shall be reformed to the minimum extent
-necessary to make such provision valid and enforceable.
-
-If Recipient institutes patent litigation against a Contributor with respect
-to a patent applicable to software (including a cross-claim or counterclaim in
-a lawsuit), then any patent licenses granted by that Contributor to such
-Recipient under this Agreement shall terminate as of the date such litigation
-is filed. In addition, if Recipient institutes patent litigation against any
-entity (including a cross-claim or counterclaim in a lawsuit) alleging that
-the Program itself (excluding combinations of the Program with other software
-or hardware) infringes such Recipient's patent(s), then such Recipient's
-rights granted under Section 2(b) shall terminate as of the date such
-litigation is filed.
-
-All Recipient's rights under this Agreement shall terminate if it fails to
-comply with any of the material terms or conditions of this Agreement and does
-not cure such failure in a reasonable period of time after becoming aware of
-such noncompliance. If all Recipient's rights under this Agreement terminate,
-Recipient agrees to cease use and distribution of the Program as soon as
-reasonably practicable. However, Recipient's obligations under this Agreement
-and any licenses granted by Recipient relating to the Program shall continue
-and survive.
-
-Everyone is permitted to copy and distribute copies of this Agreement, but in
-order to avoid inconsistency the Agreement is copyrighted and may only be
-modified in the following manner. The Agreement Steward reserves the right to
-publish new versions (including revisions) of this Agreement from time to
-time.  No one other than the Agreement Steward has the right to modify this
-Agreement.  IBM is the initial Agreement Steward. IBM may assign the
-responsibility to serve as the Agreement Steward to a suitable separate
-entity. Each new version of the Agreement will be given a distinguishing
-version number. The Program (including Contributions) may always be
-distributed subject to the version of the Agreement under which it was
-received. In addition, after a new version of the Agreement is published,
-Contributor may elect to distribute the Program (including its Contributions)
-under the new version. Except as expressly stated in Sections 2(a) and 2(b)
-above, Recipient receives no rights or licenses to the intellectual property
-of any Contributor under this Agreement, whether expressly, by implication,
-estoppel or otherwise. All rights in the Program not expressly granted under
-this Agreement are reserved.
-
-This Agreement is governed by the laws of the State of New York and the
-intellectual property laws of the United States of America. No party to this
-Agreement will bring a legal action under this Agreement more than one year
-after the cause of action arose. Each party waives its rights to a jury trial
-in any resulting litigation.
-
-==============================================================================
-.. vim: set ft=help norl ts=8 tw=78 et :
-___    ______           ______________     ________                    
-__ |  / /__(_)______ _____  ____/__  /___________(_)___  _____________ 
+___    ______           ______________     ________
+__ |  / /__(_)______ _____  ____/__  /___________(_)___  _____________
 __ | / /__  /__  __ `__ \  /    __  /_  __ \____  /_  / / /_  ___/  _ \
 __ |/ / _  / _  / / / / / /___  _  / / /_/ /___  / / /_/ /_  /   /  __/
-_____/  /_/  /_/ /_/ /_/\____/  /_/  \____/___  /  \__,_/ /_/    \___/ 
-                                           /___/                       
+_____/  /_/  /_/ /_/ /_/\____/  /_/  \____/___  /  \__,_/ /_/    \___/
+                                           /___/
 
-This archive contains a syntax file, a filetype plugin and an indent plugin
-for clojure.
+VimClojure – a Clojure environment for Vim
+==========================================
 
-The syntax is maintained by Toralf Wittner <toralf.wittner@gmail.com>. I
-included it with his permission. All kudos for the highlighting go to Toralf.
+VimClojure is one of the most sophisticated editing environments for Clojure.
+It provides syntax highlighting, indenting and command completion.
 
-Additionally I created a filetype and indent plugin. The blame for those go to
-me. The indent pugin now also works with the vectors ([]) and maps ({}). The
-ftplugin now comes with a completion dictionary. Since Clojure is still rather
-evolving the completions might get outdated overtime. For this the generation
-script by Parth Malwankar is included with his permission.
+If requested it also provides a SLIME like interface to dynamically work with
+Clojure code. For this to work the included Nailgun server must be running.
+Remote may be forwarded via ssh.
 
-To setup the plugins copy the contents of this archive to your ~/.vim directory.
-The ftdetect/clojure.vim sets up an autocommand to automatically detect .clj
-files as clojure files. The rest works automagically when you enabled the
-corresponding features (see :help :filetype).
+Features of the interactive interface are:
 
--- Meikel Brandmeyer <mb@kotka.de>
-   Frankfurt am Main, August 16th 2008
-            _________            ________________
-            __  ____/_______________(_)__  /__  /_____ _
-            _  / __ _  __ \_  ___/_  /__  /__  /_  __ `/
-            / /_/ / / /_/ /  /   _  / _  / _  / / /_/ /
-            \____/  \____//_/    /_/  /_/  /_/  \__,_/
-
-Gorilla – a Clojure environment for Vim
-=======================================
-
-Gorilla provides a similar, although as sophisticated environment for
-Vim as SLIME does for Emacs. It uses a modified Repl, which is provides
-a network interface to a running Clojure.
+- dynamic documentation lookup
+- dynamic javadoc lookup (in an external browser)
+- Repl running in a Vim buffer
+- smart omni completion
+- easy evaluation of code in a buffer
 
 Requirements
 ============
 
-You need a Ruby enabled Vim. Please note, that the Windows installars
-and MacVim already ship with Ruby enabled. Ruby itself might be installed
-separately however. For Unix (in particular Linux), your vendor probably
-already provides a Vim package with Ruby enabled.
-
-Gorilla depends on syntax highlighting as done by VimClojure to extract
-eg. s-expressions. So the latest VimClojure must be installed as well.
-
 Please make sure that the following options are set in your .vimrc:
 
 ––8<––––8<––––8<––
 filetype plugin indent on
 ––8<––––8<––––8<––
 
-Otherwise the filetype is not activated, and hence Gorilla doesn't work.
+Otherwise the filetype is not activated, and hence VimClojure doesn't work.
 
-Building Gorilla
-================
+Building the Nailgun interface
+==============================
 
-Note: Unless you patched the Clojure side of Gorilla you should never
-have to rebuild the jarfile.
-
-To build gorilla, create a local.properties file that contains the path to
-your clojure.jar and clojure-contrib.jar. Also, include standalone=true if you
-want a standalone gorilla.jar, which runs without further dependencies.
-The file should look similar to:
+To build the Nailgun interface, create a local.properties file that contains
+the path to your clojure.jar and clojure-contrib.jar. The file should look
+similar to:
 
 ––8<––––8<––––8<––
 clojure.jar=/path/to/clojure.jar
 clojure-contrib.jar=/path/to/clojure-contrib.jar
+nailgun-client=ng
 ––8<––––8<––––8<––
 
-Once you have created this file, simply run the following command:
+Once you have created this file, simply run ant. This should give a
+vimclojure.jar containing the server part and the nailgun client. Note for
+Windows users: please leave out the last line in the properties file. The
+windows client for nailgun is included in the distribution as ng.exe. Delete
+it only in case you are sure, that you can rebuild it. You may see an error
+when building the nailgun-client. That's ok.
 
-ant clean jar
+To run the Nailgun server you need the clojure.jar, clojure-contrib.jar and
+vimclojure.jar in your Classpath:
 
-To run Gorilla you need the clojure.jar, clojure-contrib.jar and
-gorilla.jar in your Classpath:
+java -cp /path/to/clojure.jar:/path/to/clojure-contrib.jar:/path/to/vimclojure.jar com.martiansoftware.nailgun.NGServer 127.0.0.1
 
-java -cp /path/to/clojure.jar:/path/to/clojure-contrib.jar:gorilla.jar de.kotka.gorilla
-
-For standalone version use:
-
-ant -Dstandalone=true clean jar
-
-This creates gorilla.jar which can be launched by typing:
-
-java -jar gorilla.jar
+Put the nailgun client somewhere into your PATH or specify the location in
+your .vimrc.
 
 Please refer to the online documentation in the doc folder for further
-information on how to use Gorilla, its features and its caveats.
+information on how to use VimClojure, its features and its caveats.
 
 Meikel Branmdeyer <mb@kotka.de>
-Frankfurt am Main, 2008
+Frankfurt am Main, 2009

File autoload/gorilla.vim

-"-
-" Copyright 2009 (c) Meikel Brandmeyer.
-" All rights reserved.
-"
-" Permission is hereby granted, free of charge, to any person obtaining a copy
-" of this software and associated documentation files (the "Software"), to deal
-" in the Software without restriction, including without limitation the rights
-" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-" copies of the Software, and to permit persons to whom the Software is
-" furnished to do so, subject to the following conditions:
-"
-" The above copyright notice and this permission notice shall be included in
-" all copies or substantial portions of the Software.
-"
-" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-" THE SOFTWARE.
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-" Helpers
-function! gorilla#ExtractSexpr(toplevel)
-	let closure = { "flag" : (a:toplevel ? "r" : "") }
-
-	function closure.f() dict
-		if searchpairpos('(', '', ')', 'bW' . self.flag,
-					\ 'vimclojure#SynIdName() !~ "clojureParen\\d"') != [0, 0]
-			return vimclojure#Yank('l', 'normal "ly%')
-		end
-		return ""
-	endfunction
-
-	return vimclojure#WithSavedPosition(closure)
-endfunction
-
-function! gorilla#BufferName()
-	let file = expand("%")
-	if file == ""
-		let file = "UNNAMED"
-	endif
-	return file
-endfunction
-
-" Key mappings and Plugs
-function! gorilla#MakePlug(mode, plug, f)
-	execute a:mode . "noremap <Plug>ClojureChimp" . a:plug
-				\ . " :call " . a:f . "<CR>"
-endfunction
-
-function! gorilla#MapPlug(mode, keys, plug)
-	if !hasmapto("<Plug>ClojureChimp" . a:plug)
-		execute a:mode . "map <buffer> <unique> <silent> <LocalLeader>" . a:keys
-					\ . " <Plug>ClojureChimp" . a:plug
-	endif
-endfunction
-
-" A Buffer...
-let gorilla#Buffer = {}
-
-function! gorilla#Buffer.goHere() dict
-	execute "buffer! " . self._buffer
-endfunction
-
-function! gorilla#Buffer.resize() dict
-	call self.goHere()
-	let size = line("$")
-	if size < 3
-		let size = 3
-	endif
-	execute "resize " . size
-endfunction
-
-function! gorilla#Buffer.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)
-endfunction
-
-function! gorilla#Buffer.close() dict
-	execute "bdelete! " . self._buffer
-endfunction
-
-" The transient buffer, used to display results.
-let gorilla#PreviewWindow = copy(gorilla#Buffer)
-
-function! gorilla#PreviewWindow.New() dict
-	pclose!
-
-	execute &previewheight . "new"
-	set previewwindow
-	set winfixheight
-
-	setlocal noswapfile
-	setlocal buftype=nofile
-	setlocal bufhidden=wipe
-
-	call append(0, "; Use \\p to close this buffer!")
-
-	return copy(self)
-endfunction
-
-function! gorilla#PreviewWindow.goHere() dict
-	wincmd P
-endfunction
-
-function! gorilla#PreviewWindow.close() dict
-	pclose
-endfunction
-
-" Nails
-if !exists("gorilla#NailgunClient")
-	let gorilla#NailgunClient = "ng"
-endif
-
-augroup Gorilla
-	autocmd CursorMovedI *.clj if pumvisible() == 0 | pclose | endif
-augroup END
-
-function! gorilla#ExecuteNailWithInput(nail, input, ...)
-	let inputfile = tempname()
-	try
-		new
-		call append(1, a:input)
-		1
-		delete
-		silent execute "write " . inputfile
-		bdelete
-
-		let cmdline = map([g:gorilla#NailgunClient,
-					\ "de.kotka.gorilla.nails." . a:nail]
-					\ + a:000,
-					\ 'shellescape(v:val)')
-		let cmd = join(cmdline, " ") . " <" . inputfile
-
-		let result = system(cmd)
-
-		if v:shell_error
-			throw "Couldn't execute Nail! " . cmd
-		endif
-	finally
-		call delete(inputfile)
-	endtry
-
-	return substitute(result, '\n$', '', '')
-endfunction
-
-function! gorilla#ExecuteNail(nail, ...)
-	return call(function("gorilla#ExecuteNailWithInput"), [a:nail, ""] + a:000)
-endfunction
-
-function! gorilla#FilterNail(nail, rngStart, rngEnd, ...)
-	let cmdline = map([g:gorilla#NailgunClient,
-				\ "de.kotka.gorilla.nails." . a:nail] + a:000,
-				\ 'shellescape(v:val)')
-	let cmd = a:rngStart . "," . a:rngEnd . "!" . join(cmdline, " ")
-
-	silent execute cmd
-endfunction
-
-function! gorilla#DocLookup(word)
-	let docs = gorilla#ExecuteNailWithInput("DocLookup", a:word,
-				\ "-n", b:gorilla_namespace)
-	let transientBuffer = g:gorilla#PreviewWindow.New()
-	call transientBuffer.showText(docs)
-	wincmd p
-endfunction
-
-function! gorilla#FindDoc()
-	let pattern = input("Pattern to look for: ")
-
-	let resultBuffer = g:gorilla#PreviewWindow.New()
-
-	call resultBuffer.showText(pattern)
-
-	call gorilla#FilterNail("FindDoc", line("$"), line("$"))
-
-	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("gorilla#JavadocPathMap")
-	let gorilla#JavadocPathMap = {}
-endif
-
-for k in keys(s:DefaultJavadocPaths)
-	if !has_key(gorilla#JavadocPathMap, k)
-		let gorilla#JavadocPathMap[k] = s:DefaultJavadocPaths[k]
-	endif
-endfor
-
-if !exists("gorilla#Browser")
-	if has("win32") || has("win64")
-		let gorilla#Browser = "start"
-	elseif has("mac")
-		let gorilla#Browser = "open"
-	else
-		let gorilla#Browser = "firefox -new-window"
-	endif
-endif
-
-function! gorilla#JavadocLookup(word)
-	let word = substitute(a:word, "\\.$", "", "")
-	let path = gorilla#ExecuteNailWithInput("JavadocPath", word,
-				\ "-n", b:gorilla_namespace)
-
-	let match = ""
-	for pattern in keys(g:gorilla#JavadocPathMap)
-		if path =~ "^" . pattern && len(match) < len(pattern)
-			let match = pattern
-		endif
-	endfor
-
-	if match == ""
-		throw "No matching Javadoc URL found for " . path
-	endif
-
-	let url = g:gorilla#JavadocPathMap[match] . path
-	call system(join([g:gorilla#Browser, url], " "))
-endfunction
-
-" Evaluators
-function! gorilla#MacroExpand(firstOnly)
-	let sexp = gorilla#ExtractSexpr(0)
-	let ns = b:gorilla_namespace
-
-	let resultBuffer = g:gorilla#PreviewWindow.New()
-	setfiletype clojure
-
-	let firstLine = line("$")
-	call resultBuffer.showText(sexp)
-	let lastLine = line("$")
-
-	let cmd = ["MacroExpand", firstLine, lastLine, "-n", ns]
-	if a:firstOnly
-		let cmd = cmd + [ "-o" ]
-	endif
-
-	call call(function("gorilla#FilterNail"), cmd)
-
-	wincmd p
-endfunction
-
-function! gorilla#EvalFile()
-	let content = getbufline(bufnr("%"), 1, line("$"))
-	let file = gorilla#BufferName()
-	let ns = b:gorilla_namespace
-	let resultBuffer = g:gorilla#PreviewWindow.New()
-
-	let startLine = line("$") + 1
-	call resultBuffer.showText(content)
-	let endLine = line("$")
-
-	call gorilla#FilterNail("Repl", startLine, endLine,
-				\ "-r", "-n", ns, "-f", file)
-	wincmd p
-endfunction
-
-function! gorilla#EvalLine()
-	let theLine = line(".")
-	let content = getline(theLine)
-	let file = gorilla#BufferName()
-	let ns = b:gorilla_namespace
-	let resultBuffer = g:gorilla#PreviewWindow.New()
-
-	call resultBuffer.showText(content)
-	let region = line("$")
-
-	call gorilla#FilterNail("Repl", region, region,
-				\ "-r", "-n", ns, "-f", file, "-l", theLine)
-	wincmd p
-endfunction
-
-function! gorilla#EvalBlock() range
-	let file = gorilla#BufferName()
-	let ns = b:gorilla_namespace
-
-	let content = getbufline(bufnr("%"), a:firstline, a:lastline)
-	let resultBuffer = g:gorilla#PreviewWindow.New()
-
-	let startLine = line("$") + 1
-	call resultBuffer.showText(content)
-	let endLine = line("$")
-
-	call gorilla#FilterNail("Repl", startLine, endLine,
-				\ "-r", "-n", ns, "-f", file, "-l", a:firstline)
-	wincmd p
-endfunction
-
-function! gorilla#EvalToplevel()
-	let file = gorilla#BufferName()
-	let ns = b:gorilla_namespace
-
-	let startPosition = searchpairpos('(', '', ')', 'bWnr',
-				\ 'vimclojure#SynIdName() !~ "clojureParen\\d"')
-	if startPosition == [0, 0]
-		throw "Not in a toplevel expression"
-	endif
-
-	let endPosition = searchpairpos('(', '', ')', 'Wnr',
-				\ 'vimclojure#SynIdName() !~ "clojureParen\\d"')
-	if endPosition == [0, 0]
-		throw "Toplevel expression not terminated"
-	endif
-
-	let expr = getbufline(bufnr("%"), startPosition[0], endPosition[0])
-	let resultBuffer = g:gorilla#PreviewWindow.New()
-
-	let startLine = line("$") + 1
-	call resultBuffer.showText(expr)
-	let endLine = line("$")
-
-	call gorilla#FilterNail("Repl", startLine, endLine,
-				\ "-r", "-n", ns, "-f", file, "-l", startPosition[0])
-	wincmd p
-endfunction
-
-function! gorilla#EvalParagraph()
-	let file = gorilla#BufferName()
-	let ns = b:gorilla_namespace
-	let startPosition = line(".")
-
-	let closure = {}
-
-	function! closure.f() dict
-		normal }
-		return line(".")
-	endfunction
-
-	let endPosition = vimclojure#WithSavedPosition(closure)
-
-	let content = getbufline(bufnr("%"), startPosition, endPosition)
-	let resultBuffer = g:gorilla#PreviewWindow.New()
-
-	let startLine = line("$") + 1
-	call resultBuffer.showText(content)
-	let endLine = line("$")
-
-	call gorilla#FilterNail("Repl", startLine, endLine,
-				\ "-r", "-n", ns, "-f", file, "-l", startPosition)
-	wincmd p
-endfunction
-
-" The Repl
-let gorilla#Repl = copy(gorilla#Buffer)
-
-let gorilla#Repl._prompt = "Gorilla=>"
-let gorilla#Repl._history = []
-let gorilla#Repl._historyDepth = 0
-let gorilla#Repl._replCommands = [ ",close" ]
-
-function! gorilla#Repl.New() dict
-	let instance = copy(self)
-
-	new
-	setlocal buftype=nofile
-	setlocal noswapfile
-
-	inoremap <buffer> <silent> <CR>     <Esc>:call b:gorilla_repl.enterHook()<CR>
-	inoremap <buffer> <silent> <C-Up>   <C-O>:call b:gorilla_repl.upHistory()<CR>
-	inoremap <buffer> <silent> <C-Down> <C-O>:call b:gorilla_repl.downHistory()<CR>
-
-	call append(line("$"), ["Clojure", self._prompt . " "])
-
-	let instance._id = gorilla#ExecuteNail("Repl", "-s")
-	let instance._buffer = bufnr("%")
-
-	let b:gorilla_repl = instance
-
-	setfiletype clojure
-
-	normal G
-	startinsert!
-endfunction
-
-function! gorilla#Repl.isReplCommand(cmd) dict
-	for candidate in self._replCommands
-		if candidate == a:cmd
-			return 1
-		endif
-	endfor
-	return 0
-endfunction
-
-function! gorilla#Repl.doReplCommand(cmd) dict
-	if a:cmd == ",close"
-		call gorilla#ExecuteNail("Repl", "-S", "-i", self._id)
-		call self.close()
-		stopinsert
-	endif
-endfunction
-
-function! gorilla#Repl.getCommand() dict
-	let ln = line("$")
-
-	while getline(ln) !~ "^" . self._prompt
-		let ln = ln - 1
-	endwhile
-
-	let cmd = vimclojure#Yank("l", ln . "," . line("$") . "yank l")
-
-	let cmd = substitute(cmd, "^" . self._prompt . "\\s*", "", "")
-	let cmd = substitute(cmd, "\n$", "", "")
-	return cmd
-endfunction
-
-function! gorilla#Repl.enterHook() dict
-	let cmd = self.getCommand()
-
-	if self.isReplCommand(cmd)
-		call self.doReplCommand(cmd)
-		return
-	endif
-
-	let rangeStart = line("$") + 1
-	call self.showText(cmd)
-	let rangeEnd = line("$")
-
-	call gorilla#FilterNail("CheckSyntax", rangeStart, rangeEnd)
-	let result = getline("$")
-	if result == "false"
-		normal G0Dix
-		normal ==x
-	else
-		normal Gdd
-		let rangeStart = line("$") + 1
-		call self.showText(cmd)
-		let rangeEnd = line("$")
-
-		call gorilla#FilterNail("Repl", rangeStart, rangeEnd,
-					\ "-r", "-i", self._id)
-
-		let self._historyDepth = 0
-		let self._history = [cmd] + self._history
-		call self.showText(self._prompt . " ")
-		normal G
-	endif
-	startinsert!
-endfunction
-
-function! gorilla#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! gorilla#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! gorilla#Repl.deleteLast() dict
-	normal G
-
-	while getline("$") !~ self._prompt
-		normal dd
-	endwhile
-
-	normal dd
-endfunction
-
-" Omni Completion
-function! gorilla#OmniCompletion(findstart, base)
-	if a:findstart == 1
-		let closure = {}
-
-		function! closure.f() dict
-			normal b
-			return col(".") - 1
-		endfunction
-
-		return vimclojure#WithSavedPosition(closure)
-	else
-		let completions = gorilla#ExecuteNailWithInput("Complete", a:base,
-					\ "-n", b:gorilla_namespace)
-		execute "let result = " . completions
-		return result
-	endif
-endfunction
-
-" Epilog
-let &cpo = s:save_cpo

File autoload/vimclojure.vim

 " Language:     Clojure
 " Maintainer:   Meikel Brandmeyer <mb@kotka.de>
 
+let s:save_cpo = &cpo
+set cpo&vim
+
 function! vimclojure#SynIdName()
 	return synIDattr(synID(line("."), col("."), 0), "name")
 endfunction
 				\ }
 	return vimclojure#WithSavedPosition(closure)
 endfunction
+
+" Nailgun part:
+function! vimclojure#ExtractSexpr(toplevel)
+	let closure = { "flag" : (a:toplevel ? "r" : "") }
+
+	function closure.f() dict
+		if searchpairpos('(', '', ')', 'bW' . self.flag,
+					\ 'vimclojure#SynIdName() !~ "clojureParen\\d"') != [0, 0]
+			return vimclojure#Yank('l', 'normal "ly%')
+		end
+		return ""
+	endfunction
+
+	return vimclojure#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)
+	execute a:mode . "noremap <Plug>Clojure" . a:plug
+				\ . " :call " . a:f . "<CR>"
+endfunction
+
+function! vimclojure#MapPlug(mode, keys, plug)
+	if !hasmapto("<Plug>Clojure" . a:plug)
+		execute a:mode . "map <buffer> <unique> <silent> <LocalLeader>" . a:keys
+					\ . " <Plug>Clojure" . a:plug
+	endif
+endfunction
+
+" A Buffer...
+let vimclojure#Buffer = {}
+
+function! vimclojure#Buffer.goHere() dict
+	execute "buffer! " . 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("")
+		let text = split(a:text, '\n')
+	else
+		let text = a:text
+	endif
+	call append(line("$"), text)
+endfunction
+
+function! vimclojure#Buffer.close() dict
+	execute "bdelete! " . self._buffer
+endfunction
+
+" The transient buffer, used to display results.
+let vimclojure#PreviewWindow = copy(vimclojure#Buffer)
+
+function! vimclojure#PreviewWindow.New() dict
+	pclose!
+
+	execute &previewheight . "new"
+	set previewwindow
+	set winfixheight
+
+	setlocal noswapfile
+	setlocal buftype=nofile
+	setlocal bufhidden=wipe
+
+	call append(0, "; Use \\p to close this buffer!")
+
+	return copy(self)
+endfunction
+
+function! vimclojure#PreviewWindow.goHere() dict
+	wincmd P
+endfunction
+
+function! vimclojure#PreviewWindow.close() dict
+	pclose
+endfunction
+
+" Nails
+if !exists("vimclojure#NailgunClient")
+	let vimclojure#NailgunClient = "ng"
+endif
+
+augroup VimClojure
+	autocmd CursorMovedI *.clj if pumvisible() == 0 | pclose | endif
+augroup END
+
+function! vimclojure#ExecuteNailWithInput(nail, input, ...)
+	let inputfile = tempname()
+	try
+		new
+		call append(1, a:input)
+		1
+		delete
+		silent execute "write " . inputfile
+		bdelete
+
+		let cmdline = map([g:vimclojure#NailgunClient,
+					\ "de.kotka.vimclojure.nails." . a:nail]
+					\ + a:000,
+					\ 'shellescape(v:val)')
+		let cmd = join(cmdline, " ") . " <" . inputfile
+
+		let result = system(cmd)
+
+		if v:shell_error
+			throw "Couldn't execute Nail! " . cmd
+		endif
+	finally
+		call delete(inputfile)
+	endtry
+
+	return substitute(result, '\n$', '', '')
+endfunction
+
+function! vimclojure#ExecuteNail(nail, ...)
+	return call(function("vimclojure#ExecuteNailWithInput"), [a:nail, ""] + a:000)
+endfunction
+
+function! vimclojure#FilterNail(nail, rngStart, rngEnd, ...)
+	let cmdline = map([g:vimclojure#NailgunClient,
+				\ "de.kotka.vimclojure.nails." . a:nail] + a:000,
+				\ 'shellescape(v:val)')
+	let cmd = a:rngStart . "," . a:rngEnd . "!" . join(cmdline, " ")
+
+	silent execute cmd
+endfunction
+
+function! vimclojure#DocLookup(word)
+	let docs = vimclojure#ExecuteNailWithInput("DocLookup", a:word,
+				\ "-n", b:vimclojure_namespace)
+	let transientBuffer = g:vimclojure#PreviewWindow.New()
+	call transientBuffer.showText(docs)
+	wincmd p
+endfunction
+
+function! vimclojure#FindDoc()
+	let pattern = input("Pattern to look for: ")
+
+	let resultBuffer = g:vimclojure#PreviewWindow.New()
+
+	call resultBuffer.showText(pattern)
+
+	call vimclojure#FilterNail("FindDoc", line("$"), line("$"))
+
+	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
+		let vimclojure#Browser = "firefox -new-window"
+	endif
+endif
+
+function! vimclojure#JavadocLookup(word)
+	let word = substitute(a:word, "\\.$", "", "")
+	let path = vimclojure#ExecuteNailWithInput("JavadocPath", word,
+				\ "-n", b:vimclojure_namespace)
+
+	let match = ""
+	for pattern in keys(g:vimclojure#JavadocPathMap)
+		if path =~ "^" . pattern && len(match) < len(pattern)
+			let match = pattern
+		endif
+	endfor
+
+	if match == ""
+		throw "No matching Javadoc URL found for " . path
+	endif
+
+	let url = g:vimclojure#JavadocPathMap[match] . path
+	call system(join([g:vimclojure#Browser, url], " "))
+endfunction
+
+" Evaluators
+function! vimclojure#MacroExpand(firstOnly)
+	let sexp = vimclojure#ExtractSexpr(0)
+	let ns = b:vimclojure_namespace
+
+	let resultBuffer = g:vimclojure#PreviewWindow.New()
+	setfiletype clojure
+
+	let firstLine = line("$")
+	call resultBuffer.showText(sexp)
+	let lastLine = line("$")
+
+	let cmd = ["MacroExpand", firstLine, lastLine, "-n", ns]
+	if a:firstOnly
+		let cmd = cmd + [ "-o" ]
+	endif
+
+	call call(function("vimclojure#FilterNail"), cmd)
+
+	wincmd p
+endfunction
+
+function! vimclojure#EvalFile()
+	let content = getbufline(bufnr("%"), 1, line("$"))
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+	let resultBuffer = g:vimclojure#PreviewWindow.New()
+
+	let startLine = line("$") + 1
+	call resultBuffer.showText(content)
+	let endLine = line("$")
+
+	call vimclojure#FilterNail("Repl", startLine, endLine,
+				\ "-r", "-n", ns, "-f", file)
+	wincmd p
+endfunction
+
+function! vimclojure#EvalLine()
+	let theLine = line(".")
+	let content = getline(theLine)
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+	let resultBuffer = g:vimclojure#PreviewWindow.New()
+
+	call resultBuffer.showText(content)
+	let region = line("$")
+
+	call vimclojure#FilterNail("Repl", region, region,
+				\ "-r", "-n", ns, "-f", file, "-l", theLine)
+	wincmd p
+endfunction
+
+function! vimclojure#EvalBlock() range
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+
+	let content = getbufline(bufnr("%"), a:firstline, a:lastline)
+	let resultBuffer = g:vimclojure#PreviewWindow.New()
+
+	let startLine = line("$") + 1
+	call resultBuffer.showText(content)
+	let endLine = line("$")
+
+	call vimclojure#FilterNail("Repl", startLine, endLine,
+				\ "-r", "-n", ns, "-f", file, "-l", a:firstline)
+	wincmd p
+endfunction
+
+function! vimclojure#EvalToplevel()
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+
+	let startPosition = searchpairpos('(', '', ')', 'bWnr',
+				\ 'vimclojure#SynIdName() !~ "clojureParen\\d"')
+	if startPosition == [0, 0]
+		throw "Not in a toplevel expression"
+	endif
+
+	let endPosition = searchpairpos('(', '', ')', 'Wnr',
+				\ 'vimclojure#SynIdName() !~ "clojureParen\\d"')
+	if endPosition == [0, 0]
+		throw "Toplevel expression not terminated"
+	endif
+
+	let expr = getbufline(bufnr("%"), startPosition[0], endPosition[0])
+	let resultBuffer = g:vimclojure#PreviewWindow.New()
+
+	let startLine = line("$") + 1
+	call resultBuffer.showText(expr)
+	let endLine = line("$")
+
+	call vimclojure#FilterNail("Repl", startLine, endLine,
+				\ "-r", "-n", ns, "-f", file, "-l", startPosition[0])
+	wincmd p
+endfunction
+
+function! vimclojure#EvalParagraph()
+	let file = vimclojure#BufferName()
+	let ns = b:vimclojure_namespace
+	let startPosition = line(".")
+
+	let closure = {}
+
+	function! closure.f() dict
+		normal }
+		return line(".")
+	endfunction
+
+	let endPosition = vimclojure#WithSavedPosition(closure)
+
+	let content = getbufline(bufnr("%"), startPosition, endPosition)
+	let resultBuffer = g:vimclojure#PreviewWindow.New()
+
+	let startLine = line("$") + 1
+	call resultBuffer.showText(content)
+	let endLine = line("$")
+
+	call vimclojure#FilterNail("Repl", startLine, endLine,
+				\ "-r", "-n", ns, "-f", file, "-l", startPosition)
+	wincmd p
+endfunction
+
+" The Repl
+let vimclojure#Repl = copy(vimclojure#Buffer)
+
+let vimclojure#Repl._prompt = "Clojure=>"
+let vimclojure#Repl._history = []
+let vimclojure#Repl._historyDepth = 0
+let vimclojure#Repl._replCommands = [ ",close" ]
+
+function! vimclojure#Repl.New() dict
+	let instance = copy(self)
+
+	new
+	setlocal buftype=nofile
+	setlocal noswapfile
+
+	inoremap <buffer> <silent> <CR>     <Esc>:call b:vimclojure_repl.enterHook()<CR>
+	inoremap <buffer> <silent> <C-Up>   <C-O>:call b:vimclojure_repl.upHistory()<CR>
+	inoremap <buffer> <silent> <C-Down> <C-O>:call b:vimclojure_repl.downHistory()<CR>
+
+	call append(line("$"), ["Clojure", self._prompt . " "])
+
+	let instance._id = vimclojure#ExecuteNail("Repl", "-s")
+	let instance._buffer = bufnr("%")
+
+	let b:vimclojure_repl = instance
+
+	setfiletype clojure
+
+	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
+	endif
+endfunction
+
+function! vimclojure#Repl.getCommand() dict
+	let ln = line("$")
+
+	while getline(ln) !~ "^" . self._prompt
+		let ln = ln - 1
+	endwhile
+
+	let cmd = vimclojure#Yank("l", ln . "," . line("$") . "yank l")
+
+	let cmd = substitute(cmd, "^" . self._prompt . "\\s*", "", "")
+	let cmd = substitute(cmd, "\n$", "", "")
+	return cmd
+endfunction
+
+function! vimclojure#Repl.enterHook() dict
+	let cmd = self.getCommand()
+
+	if self.isReplCommand(cmd)
+		call self.doReplCommand(cmd)
+		return
+	endif
+
+	let rangeStart = line("$") + 1
+	call self.showText(cmd)
+	let rangeEnd = line("$")
+
+	call vimclojure#FilterNail("CheckSyntax", rangeStart, rangeEnd)
+	let result = getline("$")
+	if result == "false"
+		normal G0Dix
+		normal ==x
+	else
+		normal Gdd
+		let rangeStart = line("$") + 1
+		call self.showText(cmd)
+		let rangeEnd = line("$")
+
+		call vimclojure#FilterNail("Repl", rangeStart, rangeEnd,
+					\ "-r", "-i", self._id)
+
+		let self._historyDepth = 0
+		let self._history = [cmd] + self._history
+		call self.showText(self._prompt . " ")
+		normal G
+	endif
+	startinsert!
+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
+
+" Omni Completion
+function! vimclojure#OmniCompletion(findstart, base)
+	if a:findstart == 1
+		let closure = {}
+
+		function! closure.f() dict
+			normal b
+			return col(".") - 1
+		endfunction
+
+		return vimclojure#WithSavedPosition(closure)
+	else
+		let completions = vimclojure#ExecuteNailWithInput("Complete", a:base,
+					\ "-n", b:vimclojure_namespace)
+		execute "let result = " . completions
+		return result
+	endif
+endfunction
+
+" Epilog
+let &cpo = s:save_cpo
-<project name="gorilla" default="all">
+<project name="vimclojure" default="all">
 
 	<description>
 		Build with "ant all".
 
 	<property name="src" location="src"/>
 	<property name="build" location="classes"/>
-	<property name="gorilla_jar" location="gorilla.jar"/>
+	<property name="jarfile" location="vimclojure.jar"/>
 
 	<property file="local.properties"/>
 
 				<pathelement location="${clojure-contrib.jar}"/>
 			</classpath>
 			<sysproperty key="clojure.compile.path" value="${build}"/>
-			<arg value="de.kotka.gorilla"/>
-			<arg value="de.kotka.gorilla.util"/>
-			<arg value="de.kotka.gorilla.repl"/>
-			<arg value="de.kotka.gorilla.backend"/>
-			<arg value="de.kotka.gorilla.nails"/>
+			<arg value="de.kotka.vimclojure.gencompletions"/>
+			<arg value="de.kotka.vimclojure.util"/>
+			<arg value="de.kotka.vimclojure.repl"/>
+			<arg value="de.kotka.vimclojure.backend"/>
+			<arg value="de.kotka.vimclojure.nails"/>
 		</java>
 	</target>
 
 		</exec>
 	</target>
 
-	<target name="prepare-full-jar" depends="init,aot,nailgun-server"
-		description="Include clojure and contrib sources."
-		if="standalone">
-		<unzip dest="${build}">
-			<patternset>
-				<include name="clojure/**/*.class"/>
-			</patternset>
-			<path location="${clojure.jar}"/>
-			<path location="${clojure-contrib.jar}"/>
-		</unzip>
-		<jar jarfile="${gorilla_jar}">
-			<path location="README.txt"/>
-			<path location="LICENSE.txt"/>
-			<fileset dir="${src}" includes="**/*.clj"/>
-			<fileset dir="${build}" includes="**/*.class"/>
-			<manifest>
-				<attribute name="Class-Path" value="."/>
-				<attribute name="Main-Class" value="de.kotka.gorilla"/>
-			</manifest>
-		</jar>
-	</target>
-
-	<target name="prepare-small-jar" depends="aot,nailgun-server"
-			description="Create jar file."
-			unless="standalone">
-		<jar jarfile="${gorilla_jar}">
+	<target name="jar" depends="aot,nailgun-server"
+		description="Create jar file.">
+		<jar jarfile="${jarfile}">
 			<path location="README.txt"/>
 			<path location="LICENSE.txt"/>
 			<fileset dir="${src}" includes="**/*.clj"/>
 		</jar>
 	</target>
 
-	<target name="jar" depends="prepare-small-jar,prepare-full-jar"/>
-
 	<target name="all" depends="jar,nailgun-client"/>
 
 	<target name="clean"
 		description="Remove autogenerated files and directories.">
 		<delete dir="${build}"/>
-		<delete file="${gorilla_jar}"/>
+		<delete file="${jarfile}"/>
 		<delete file="${nailgun-client}"/>
 	</target>
 

File de/kotka/vimclojure/gencompletions.clj

-; Copyright (c) 2008 Parth Malwankar
-; Copyright (c) 2008 Meikel Brandmeyer
-; All rights reserved.
-;
-; A small script to generate a dictionary of Clojure's core
-; functions. The script was written by Parth Malwankar. It
-; is included in VimClojure with his permission.
-;  -- Meikel Brandmeyer, 16 August 2008
-;     Frankfurt am Main, Germany
-;
-; Move to new main functionality.
-;  -- Meikel Brandmeyer, 23 November 2008
-;
-; See also: http://en.wikibooks.org/wiki/Clojure_Programming
-
-(ns de.kotka.vimclojure.gencompletions
-  (:gen-class
-     :main true))
-
-(defmacro with-out-file [pathname & body]
-  `(with-open [stream# (new java.io.FileWriter ~pathname)]
-     (binding [*out* stream#]
-       ~@body)))
-
-(defn -main
-  [nspace]
-  (let [completions (keys (ns-publics (symbol nspace)))]
-    (with-out-file (str nspace "-keys.txt")
-      (doseq [x (sort completions)]
-        (println x)))))

File doc/clojure.txt

-CLOJURE						*clojure.vim* *ft-clj-syntax*
+*vimclojure.txt*                    *clojure.vim*
 
-The clojure syntax highlighting provides two options:
+VimClojure - A Clojure Environment
+==================================
+
+Introduction
+------------
+
+VimClojure is a filetype plugin and development environment for Clojure. It
+provides indenting, syntax highlighting and – if configured – interactive
+features like omni completion, documentation lookup and a Repl running in a
+Vim buffer.
+
+Nailgun Server                      *clj-nailgun-server*
+--------------
+
+To use the interactive part you have to start the nailgun server via the jar file.
+Make sure, that clojure and clojure-contrib are in your classpath and start
+the com.martiansoftware.nailgun.NGServer class. Example invocation:
 >
-	g:clj_highlight_builtins
-		If it exists and is nonzero, then Clojure's builtin functions
-		are highlighted. This useful to distuingish macros and special
-		forms from functions.
+        java -cp clojure.jar:clojure-contrib.jar:vimclojure.jar com.martiansoftware.nailgun.NGServer 127.0.0.1
+<
+This may look different depending on your system.
 
-	g:clj_highlight_contrib
-		If it exists and is nonzero, then Clojure-Contrib's functions
-		are highlighted.
+You can stop the server by invoking the nailgun client with the ng-stop
+argument.
+>
+        ng ng-stop
+<
+Set the clj_wants_gorilla variable in your vimrc.
+>
+        let g:clj_wants_gorilla = 1
+<
 
-	g:clj_paren_rainbow
-		If it exists and is nonzero, then differing levels of
-		parenthesisation will receive different highlighting.
+Syntax Highlighting                 *ft-clj-syntax*
+-------------------
+
+The clojure syntax highlighting provides several options:
+>
+        g:clj_highlight_builtins
+                If it exists and is nonzero, then Clojure's builtin functions
+                are highlighted. This useful to distuingish macros and special
+                forms from functions.
+
+        g:clj_highlight_contrib
+                If it exists and is nonzero, then Clojure-Contrib's functions
+                are highlighted. (Currently incomplete)
+
+        g:clj_paren_rainbow
+                If it exists and is nonzero, then differing levels of
+                parenthesisation will receive different highlighting.
 <
 The g:clj_paren_rainbow option provides 10 levels of individual colorisation
 for the parentheses. Because of the quantity of colorisation levels, unlike
 non-rainbow highlighting, the rainbow mode specifies its highlighting using
 ctermfg and guifg, thereby bypassing the usual colorscheme control using
 standard highlighting groups. The actual highlighting used depends on the
-dark/bright setting  (see |'bg'|).
+dark/bright setting (see |'bg'|).
+
+Keybindings
+-----------
+
+Note: <LocalLeader> is a Vim feature. More information can be found
+under the |maplocalleader| help topic.
+
+<LocalLeader>et                                 *et* *EvaluateTop*
+                        Send off the toplevel sexpression currently
+                        containing the cursor to the Clojure server.
+
+<LocalLeader>es                                 *es* *EvaluateSexp*
+                        Send off the innermost sexpression currently
+                        containing the cursor to the Clojure server.
+
+<LocalLeader>eb                                 *eb* *EvaluateBlock*
+                        Send off the the mark visual block to the
+                        Clojure server. Obviously this mapping is only
+                        active in visual mode.
+
+<LocalLeader>ef                                 *ef* *EvaluateFile*
+                        Send off the current file to the Clojure Server.
+
+<LocalLeader>rf                                 *rf* *RequireFile*
+                        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
+                        or NFS.
+
+<LocalLeader>me                                 *me* *MacroExpand*
+                        Expand the innermost sexpression currently
+                        containing the cursor using macroexpand.
+
+<LocalLeader>m1                                 *m1* *MacroExpand1*
+                        Same as MacroExpand, but use macroexpand-1.
+
+
+<LocalLeader>lw                                 *lw* *LookupWord*
+                        Lookup up the word under the cursor and print
+                        the documentation for it via (doc).
+
+<LocalLeader>li                                 *li* *LookupInteractive*
+                        Lookup the documentation of an arbitrary word.
+                        The user is prompted for input.
+
+<LocalLeader>fd                                 *fd* *FindDocumentation*
+                        Find a the documentation for a given pattern
+                        with (find-doc). The user is prompted for input.
+
+<LocalLeader>jw                                 *jw* *JavadocWord*
+                        Open the javadoc for the word under the cursor
+                        in an external browser.
+
+<LocalLeader>ji                                 *ji* *JavadocInteractive*
+                        Open the javadoc for an arbitrary word in an
+                        external browser. The user is prompted for input.
+
+<LocalLeader>sr                                 *sr* *StartRepl*
+                        Start a new Vim Repl in a fresh buffer. There
+                        might be multiple Repls at the same time.
+
+Vim Repl
+--------
+
+Start a Repl via the |sr| shortcut. At the prompt just type expressions.
+Hitting enter will determine, whether the expression is complete and
+will send it to the Clojure instance. In case the expression is incomplete,
+eg. after "(defn foo" will result in a newline for multiline expressions.
+
+Previously sent expressions may be recalled via <C-Up> and <C-Down>.
+Note: sending multiple expressions will save them in the same history
+entry. So playing back with <C-Up> will again send all of the contained
+expressions.
+
+Omni Completion
+---------------
+
+VimClojure supports omni completion for Clojure code. Hitting <C-X><C-O> in
+insert mode will try to provide completions for the item in front of the
+cursor. The match is fuzzy at dash boundaries, eg. r-s => read-string.
+
+Note: Completion of symbols and keywords is also provided via the <C-N>
+functionality of Vim.
+
+License
+-------
+
+Copyright (c) 2008,2009 Meikel Brandmeyer, Frankfurt am Main
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+==============================================================================
+.. vim: set ft=help norl ts=8 tw=78 et :

File doc/gorilla.txt

-*gorilla.txt*                       Gorilla
-
-Gorilla - A Clojure Environment
-===============================
-
-Introduction
-------------
-
-Gorilla is the successor of Chimp for Clojure. It uses a network connection
-to talk to running Clojure. This has several advantages over Chimp. The main
-factor is, that it's a two-way street where the screen interface is only one
-way. This makes eg. balloons with docstrings possible. Also using a second
-channel to send expressions doesn't interfere with the user command history.
-
-Unfortunately Vim itself is quite powerful but in some strange way incapable
-of doing what we want. So we have to resort to the Ruby interface to connect
-via the network to a running Clojure repl server.
-
-For Windows users the Ruby dependency might be also more tolerable than the
-Cygwin dependency for screen.
-
-It currently supports the extraction and sending of s-expressions, the lookup
-of docstrings and expansion of macros.
-
-A feature unique to Gorilla compared to Chimp is the Repl running in a Vim
-buffer. Supports syntax highlighting, indenting of multi-line expressions
-and command history. This is currently very experimental.
-
-To use Gorilla you have to start Clojure via the accompanying jar file.
-Make sure, that clojure and clojure-contrib are in your classpath and start
-the de.kotka.gorilla class. Keep this somewhere in the foreground to be able
-to kill it. Example invocation:
->
-        java -cp clojure.jar:clojure-contrib.jar:gorilla.jar de.kotka.gorilla
-<
-This may look different depending on your system.
-
-Requirements
-------------
-
-As stated above, Gorilla needs a Ruby enabled Vim, in particular this
-means that Ruby must be installed on your system. Note: The Windows
-installers and MacVim already ship with Ruby enabled. For Unix, your vendor
-probably provides similar packages.
-
-Gorilla depends on the VimClojure to extract s-expressions. Make sure that
-syntax highlighting and filetype plugins are activated.
-
-Keybindings
------------
-
-<LocalLeader>et                                 *et* *EvaluateTop*
-                        Send off the toplevel sexpression currently
-                        containing the cursor to the Clojure server.
-
-<LocalLeader>es                                 *es* *EvaluateSexp*
-                        Send off the innermost sexpression currently
-                        containing the cursor to the Clojure server.
-
-<LocalLeader>eb                                 *eb* *EvaluateBlock*
-                        Send off the the mark visual block to the
-                        Clojure server. Obviously this mapping is only
-                        active in visual mode.
-
-<LocalLeader>ef                                 *ef* *EvaluateFile*
-                        Send off the current file to the Clojure Server.
-
-<LocalLeader>rf                                 *rf* *RequireFile*
-                        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
-                        or NFS.
-
-<LocalLeader>me                                 *me* *MacroExpand*
-                        Expand the innermost sexpression currently
-                        containing the cursor using macroexpand.
-
-<LocalLeader>m1                                 *m1* *MacroExpand1*
-                        Same as MacroExpand, but use macroexpand-1.
-
-
-<LocalLeader>lw                                 *lw* *LookupWord*
-                        Lookup up the word under the cursor and print
-                        the documentation for it via (doc).
-
-<LocalLeader>li                                 *li* *LookupInteractive*
-                        Lookup the documentation of an arbitrary word.
-                        The user is prompted for input.
-
-<LocalLeader>fd                                 *fd* *FindDocumentation*
-                        Find a the documentation for a given pattern
-                        with (find-doc). The user is prompted for input.
-
-<LocalLeader>jw                                 *jw* *JavadocWord*
-                        Open the javadoc for the word under the cursor
-                        in an external browser.
-
-<LocalLeader>ji                                 *ji* *JavadocInteractive*
-                        Open the javadoc for an arbitrary word in an
-                        external browser. The user is prompted for input.
-
-<LocalLeader>sw                                 *sw* *ShowWord*
-                        "Show" the class under the cursor and print
-                        the information about the class like (static)
-                        methods and fields.
-
-<LocalLeader>si                                 *si* *ShowInteractive*
-                        "Show" the information of an arbitrary class.
-                        The user is prompted for input.
-
-<LocalLeader>gw                                 *gw* *GoWord*
-                        Go to the source definition of the word under
-                        the cursor. The sources of the namespace must
-                        be locally installed and be reachable with the
-                        path option. eg.
->
-                          set path+=/path/to/clojure/src/clj
-<
-<LocalLeader>gi                                 *gi* *GoInteractive*
-                        Go to the source defintion of an arbitrary
-                        item. The user is prompted for input.
-
-<LocalLeader>sr                                 *sr* *StartRepl*
-                        Start a new Vim Repl in a fresh buffer. There
-                        might be multiple Repls at the same time.
-
-Note: <LocalLeader> is a Vim feature. More information can be found
-under the |maplocalleader| help topic.
-
-Vim Repl
---------
-
-Start a Repl via the |sr| shortcut. At the prompt just type expressions.
-Hitting enter will determine, whether the expression is complete and
-will send it to the Clojure instance. In case the expression is incomplete,
-eg. after "(defn foo" will result in a newline for multiline expressions.
-
-Previously sent expressions may be recalled via <C-Up> and <C-Down>.
-Note: sending multiple expressions will save them in the same history
-entry. So playing back with <C-Up> will again send all of the contained
-expressions.
-
-Omni Completion
----------------
-
-Gorilla supports omni completion for Clojure code. Hitting <C-X><C-O> in
-insert mode will try to provide completions for the item in front of the
-cursor.
-
-Note: This is only implemented for lookup of the static class members at
-the moment.
-
-Note: Completion of symbols and keywords is already provided by VimClojure
-via the <C-N> functionality.
-
-License
--------
-
-Copyright (c) 2008 Meikel Brandmeyer, Frankfurt am Main
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-==============================================================================
-.. vim: set ft=help norl ts=8 tw=78 et :

File ftdetect/clojure.vim

+au BufNewFile,BufRead *.clj setfiletype clojure

File ftplugin/clojure.vim

 	return vimclojure#WithSavedPosition(closure)
 endfunction
 
-if exists("g:clj_want_folding") && g:clj_want_folding == 1
+" 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
 
+if exists("g:clj_want_gorilla") && g:clj_want_gorilla == 1
+	call vimclojure#MakePlug("n", "DocLookupWord", 'vimclojure#DocLookup(expand("<cword>"))')
+	call vimclojure#MakePlug("n", "DocLookupInteractive", 'vimclojure#DocLookup(input("Symbol to look up: "))')
+	call vimclojure#MakePlug("n", "JavadocLookupWord", 'vimclojure#JavadocLookup(expand("<cword>"))')
+	call vimclojure#MakePlug("n", "JavadocLookupInteractive", 'vimclojure#JavadocLookup(input("Class to lookup: "))')
+	call vimclojure#MakePlug("n", "FindDoc", 'vimclojure#FindDoc())')
+
+	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#MakePlug("n", "MacroExpand",  'vimclojure#MacroExpand(0)')
+	call vimclojure#MakePlug("n", "MacroExpand1", 'vimclojure#MacroExpand(1)')
+
+	call vimclojure#MapPlug("n", "me", "MacroExpand")
+	call vimclojure#MapPlug("n", "m1", "MacroExpand1")
+
+	call vimclojure#MakePlug("n", "EvalFile",      'vimclojure#EvalFile()')
+	call vimclojure#MakePlug("n", "EvalLine",      'vimclojure#EvalLine()')
+	call vimclojure#MakePlug("v", "EvalBlock",     'vimclojure#EvalBlock()')
+	call vimclojure#MakePlug("n", "EvalToplevel",  'vimclojure#EvalToplevel()')
+	call vimclojure#MakePlug("n", "EvalParagraph", 'vimclojure#EvalParagraph()')
+
+	call vimclojure#MapPlug("n", "ef", "EvalFile")
+	call vimclojure#MapPlug("n", "el", "EvalLine")
+	call vimclojure#MapPlug("v", "eb", "EvalBlock")
+	call vimclojure#MapPlug("n", "et", "EvalToplevel")
+	call vimclojure#MapPlug("n", "ep", "EvalParagraph")
+
+	call vimclojure#MakePlug("n", "StartRepl", 'vimclojure#Repl.New()')
+	call vimclojure#MapPlug("n", "sr", "StartRepl")
+
+	nnoremap <buffer> <silent> <unique> <LocalLeader>p :pclose!<CR>
+
+	setlocal omnifunc=vimclojure#OmniCompletion
+
+	" Get the namespace of the buffer.
+	let s:content = getbufline(bufnr("%"), 1, line("$"))
+	let b:vimclojure_namespace = vimclojure#ExecuteNailWithInput("NamespaceOfFile", s:content)
+	unlet s:content
+endif
+
 let &cpo = s:cpo_save

File ftplugin/clojure/gorilla.vim

-"-
-" Copyright 2009 (c) Meikel Brandmeyer.
-" All rights reserved.
-"
-" Permission is hereby granted, free of charge, to any person obtaining a copy
-" of this software and associated documentation files (the "Software"), to deal
-" in the Software without restriction, including without limitation the rights
-" to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-" copies of the Software, and to permit persons to whom the Software is
-" furnished to do so, subject to the following conditions:
-"
-" The above copyright notice and this permission notice shall be included in
-" all copies or substantial portions of the Software.
-"
-" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-" OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-" THE SOFTWARE.
-
-if exists("b:gorilla_loaded")
-	finish
-endif
-let b:gorilla_loaded = "2.0.0"
-
-let s:save_cpo = &cpo
-set cpo&vim
-
-call gorilla#MakePlug("n", "DocLookupWord", 'gorilla#DocLookup(expand("<cword>"))')
-call gorilla#MakePlug("n", "DocLookupInteractive", 'gorilla#DocLookup(input("Symbol to look up: "))')
-call gorilla#MakePlug("n", "JavadocLookupWord", 'gorilla#JavadocLookup(expand("<cword>"))')
-call gorilla#MakePlug("n", "JavadocLookupInteractive", 'gorilla#JavadocLookup(input("Class to lookup: "))')
-call gorilla#MakePlug("n", "FindDoc", 'gorilla#FindDoc())')
-
-call gorilla#MapPlug("n", "lw", "DocLookupWord")
-call gorilla#MapPlug("n", "li", "DocLookupInteractive")
-call gorilla#MapPlug("n", "jw", "JavadocLookupWord")
-call gorilla#MapPlug("n", "ji", "JavadocLookupInteractive")
-call gorilla#MapPlug("n", "fd", "FindDoc")
-
-call gorilla#MakePlug("n", "MacroExpand",  'gorilla#MacroExpand(0)')
-call gorilla#MakePlug("n", "MacroExpand1", 'gorilla#MacroExpand(1)')
-
-call gorilla#MapPlug("n", "me", "MacroExpand")
-call gorilla#MapPlug("n", "m1", "MacroExpand1")
-
-call gorilla#MakePlug("n", "EvalFile",      'gorilla#EvalFile()')
-call gorilla#MakePlug("n", "EvalLine",      'gorilla#EvalLine()')
-call gorilla#MakePlug("v", "EvalBlock",     'gorilla#EvalBlock()')
-call gorilla#MakePlug("n", "EvalToplevel",  'gorilla#EvalToplevel()')
-call gorilla#MakePlug("n", "EvalParagraph", 'gorilla#EvalParagraph()')
-
-call gorilla#MapPlug("n", "ef", "EvalFile")
-call gorilla#MapPlug("n", "el", "EvalLine")
-call gorilla#MapPlug("v", "eb", "EvalBlock")
-call gorilla#MapPlug("n", "et", "EvalToplevel")
-call gorilla#MapPlug("n", "ep", "EvalParagraph")
-
-call gorilla#MakePlug("n", "StartRepl", 'gorilla#Repl.New()')
-call gorilla#MapPlug("n", "sr", "StartRepl")
-
-nnoremap <buffer> <silent> <unique> <LocalLeader>p :pclose!<CR>
-
-setlocal omnifunc=gorilla#OmniCompletion
-
-" Get the namespace of the buffer.
-let s:content = getbufline(bufnr("%"), 1, line("$"))
-let b:gorilla_namespace = gorilla#ExecuteNailWithInput("NamespaceOfFile", s:content)
-unlet s:content
-
-let &cpo = s:save_cpo

File src/de/kotka/gorilla.clj

-;-
-; Copyright 2008 (c) Meikel Brandmeyer.
-; All rights reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-; THE SOFTWARE.
-
-(clojure.core/ns de.kotka.gorilla
-  (:gen-class)
-  (:require
-     [clojure.contrib.repl-ln :as repl])
-  (:use
-     [clojure.contrib.def :only (defvar-)])
-  (:import
-     (clojure.lang RT LineNumberingPushbackReader)
-     (java.io PushbackReader StringReader InputStreamReader
-              OutputStreamWriter PrintWriter)
-     (java.net InetAddress ServerSocket Socket)
-     (java.lang.reflect Modifier Method Constructor)))
-
-(defn uniq
-  [l]
-  (cons (first l)
-        (mapcat (fn [[x y]] (when-not (= x y) [y]))
-                (partition 2 1 l))))
-
-(defn get-static-info
-  [c]
-  (let [items (concat (.getFields c) (.getMethods c) (.getConstructors c))
-        items (filter #(pos? (bit-and Modifier/STATIC (.getModifiers %))) items)
-        items (map #(.getName %) items)
-        items (uniq items)]
-    (doseq [i items] (println i))))
-
-;; From: http://groups.google.com/group/clojure/msg/96ed91f823305f02
-;; by: Chris Houser
-;; usage:
-;; (show Object)   ; give it a class
-;; (show Object 1) ; a class and a method number to see details
-;; (show {})       ; or give it an instance
-
-(defn show
-  ([x] (show x nil))
-  ([x i]
-   (let [c (if (class? x) x (class x))
-         items (sort
-                 (for [m (concat (.getFields c)
-                                 (.getMethods c)
-                                 (.getConstructors c))]
-                   (let [static? (bit-and Modifier/STATIC
-                                          (.getModifiers m))
-                         method? (instance? Method m)
-                         ctor?   (instance? Constructor m)
-                         text (if ctor?
-                                (str "(" (apply str (interpose ", " (.getParameterTypes m))) ")")
-                                (str
-                                  (if (pos? static?) "static ")
-                                  (.getName m) " : "
-                                  (if method?
-                                    (str (.getReturnType m) " ("
-                                         (count (.getParameterTypes m)) ")")
-                                    (str (.getType m)))))]
-                     [(- static?) method? text (str m) m])))]
-     (if i
-       (last (nth items i))
-       (do (println "=== " c " ===")
-         (doseq [[e i] (map list items (iterate inc 0))]
-           (printf "[%2d] %s%n" i (nth e 2))))))))
-