Tamas Kovacs avatar Tamas Kovacs committed 95af40a

Version 0.9.0

Separate buffers for SLDB and Inspector, toggle frame information in SLDB buffer by pressing Enter, look up source when pressing Enter on filename with location in SLDB, added option g:swank_block_size to override Swank output buffer size (thanks to stassats on #lisp and Philipp Marek), removed old non-swank functionality, removed option g:slimv_repl_open, paredit: new mappings [[ and ]] for previous and next defun, bugfixes: various refresh problems (thanks to Philipp Marek), disable debug mode when reconnecting Swank (by Philipp Marek), display multi-line debug condition and frame source location, quote characters in compile (by Philipp Marek), use proper SLDB level when invoking restart (by Philipp Marek), restore all lisp keyword characters in iskeyword, indentation of defgeneric, use proper filename and location when compiling defun or region, buffer corruption when re-triggering timer in insert mode, <End> moved cursor to the right edge of screen in REPL buffer when virtualmode=all.

Comments (0)

Files changed (9)

 
 Slimv opens the lisp REPL (Read-Eval-Print Loop) inside a Vim buffer. Lisp commands may be entered and executed in the REPL buffer, just as in a regular REPL.
 
-Slimv supports SLIME's debugger, profiler, cross reference, arglist, indentation, symbol name completion functions. The script also has a Common Lisp Hyperspec lookup feature and it is able to lookup symbols in the Clojure API, as well as in JavaDoc.
+Slimv supports SLIME's debugger, inspector, profiler, cross reference, arglist, indentation, symbol name completion functions. The script also has a Common Lisp Hyperspec lookup feature and it is able to lookup symbols in the Clojure API, as well as in JavaDoc.
 
 Slimv comes with Paredit Mode, which is similar to the functionality of paredit.el in Emacs. Paredit Mode tries to maintain the balanced state of matched characters (parenthesis marks, square and curly braces, double quotes). Matched characters are inserted and removed in pairs, also when working with a block of text (well, mostly). Slimv also implements many paredit.el s-expression handling functions, like Split/Join/Wrap/Splice. Slurpage and Barfage known from Emacs is also possible but in a different fashion: you don't move the list element in or out of the list, rather you move the opening or closing parenthesis over the element or sub-list.
 
     *  Abort
     *  Quit to Toplevel
     *  Continue
+    *  List Threads
+    *  Kill Thread
+    *  Debug Thread
 
 Compile commands:
     *  Compile Defun
-*paredit.txt*                    Slimv               Last Change: 25 Aug 2011
+*paredit.txt*                    Slimv               Last Change: 05 Sep 2011
 
 Paredit mode for Slimv                                *paredit* *slimv-paredit*
                                Version 0.8.6
 the Lisp or Clojure programming language.
 
 |paredit-mode|               Paredit mode
+|paredit-keys|               Paredit keybindings
 |paredit-options|            Paredit options
 
 ===============================================================================
 .lisp, .clj, .scm, etc files.
 
 
+===============================================================================
+PAREDIT KEYBINDINGS                                              *paredit-keys*
+
 Here follows a list of paredit keybindings:
 
 
     )              Finds closing ')' of the current list. Can be pressed
                    repeatedly until the closing of the top level form reached.
 
+    [[             Go to the start of current/previous defun.
+
+    ]]             Go to the start of next defun.
+
     <Leader><      If standing on a delimiter (parenthesis or square bracket)
                    then moves it to the left by slurping or barfing the
                    s-expression to the left, depending on the direction of the
                    <, >, J, O, W, S
 
 
+Vim has many built-in mappings for manipulating s-expressions. Here follows a
+list of useful commands, these are not defined by paredit.vim, they are
+available even when paredit mode is switched off.
+
+    %              Find the matching pair of the parenthesis the cursor is
+                   standing on.
+
+    d%             Delete till the matching parenthesis. Normally it is used
+                   when the cursor is standing on a parenthesis (works with
+                   square or curly braces as well). If not standing on a
+                   parenthesis then deletes left till the first opening paren,
+                   so this command may also be used to delete an s-expression
+                   that is right before the cursor.
+
+    daw            Delete a word. Can be used to delete a list element, the
+                   cursor may be placed anywhere in the element.
+
+    da(            Delete the innermost s-expression. The cursor may be placed
+                   anywhere inside the s-expression.
+
+    di(            Same as da( but does not delete the enclosing parens.
+
+
 ===============================================================================
 PAREDIT OPTIONS                                               *paredit-options*
 
-*slimv.txt*                    Slimv                 Last Change: 25 Aug 2011
+*slimv.txt*                    Slimv                 Last Change: 05 Oct 2011
 
 Slimv                                                                  *slimv*
-                               Version 0.8.6
+                               Version 0.9.0
 
 The Superior Lisp Interaction Mode for Vim.
 This plugin is aimed to help Lisp development by interfacing between Vim and
 the Lisp REPL, similarly to Emacs/SLIME.
+Slimv is actually a SWANK (TCP server for Emacs) client.
 Slimv works on Windows, Linux, and Mac OS X, however the newly introduced
 Paredit mode is operating system independent. Please visit |paredit.txt| for
 additional information on Paredit mode.
-The current version of Slimv contains a SWANK (TCP server for Emacs) client.
-Please visit |swank.txt| for additional information on the SWANK client.
 
 |slimv-installation|         Installation
-|slimv-customization|        Customization
-|slimv-swank|                SWANK client
-|slimv-usage|                Usage
+|slimv-configuration|        Configuration
+|slimv-swank|                SWANK Features implemented in Slimv
 |slimv-repl|                 Lisp REPL inside Vim
 |slimv-clojure|              Clojure support
 |slimv-scheme|               Scheme support
 |slimv-package|              Package and Namespace handling
-|slimv-profiling|            Profiling
 |slimv-hyperspec|            Hyperspec Lookup and Completion
 |slimv-paredit|              Paredit mode
 |slimv-external|             External utilities
 
 Prerequisites:
 
-  Note: the system requirements are different for the SWANK client, please find
-  details in |swank-installation|.
-
   Required components:
-  - Lisp (any console Common Lisp implementation should be OK) or Clojure or
-    MIT Scheme (Linux only) installed.
-  - Python 2.4 or later installed. When using the SWANK client the same Python
-    version is needed that Vim is compiled against.
-    When not using the SWANK client then due to a Popen bug in the Cygwin
-    Python implementation Cygwin users should install Windows Python,
-    which is autodetected by the script.
+  - Vim 7.0 or newer installed with Python feature enabled.
+    This can be verified by the :ver command, look for the +python string.
+    It is recommended to have also the +balloon_eval feature for displaying
+    symbol descriptions in tooltip.
+  - Python 2.4 or later installed.
+    Must be the same Python version that was Vim compiled against.
+    This can also be verified by the :ver command, look for the
+    -DDYNAMIC_PYTHON_DLL=\"pythonXX\" string, where XX is the required
+    Python version.
+  - Lisp or Clojure or MIT Scheme (Linux only) installed.
+    Any Lisp implementation is OK that has SLIME support.
 
   Optional components:
-  - The interrupt functionality needs the pywin32 extension on Windows, but
-    only when not using the SWANK server.
   - "Exuberant ctags" for tags file generation (if not bundled with Vim
     already). See |slimv-ctags|.
+  - Slimv also contains SLIME (in fact the SWANK server part of SLIME) and
+    Swank Clojure. If you intend to use your own version of SLIME, then you
+    need to have your own SWANK server installed.
+    For example Clojure users might consider installing Leiningen and run the
+    SWANK server via 'lein swank', or use Cake via 'cake swank'.
 
 To install the script:
 
 
        doc/paredit.txt
        doc/slimv.txt
-       doc/swank.txt
        ftdetect/clojure.vim
-       ftplugin/slimv.py
        ftplugin/slimv.vim
        ftplugin/slimv-clhs.vim
        ftplugin/slimv-cljapi.vim
     directory.
   - Enter path definitions into your vimrc (if the default values are not
     valid for your Vim/Python/Lisp installation).
-    See |slimv-customization| below on how to do this.
-  - On Linux some login shells (like fish) might be incompatible with the Vim
-    temporary file generation, which results in getting random E484 errors.
-    This is because Vim expects a POSIX-compliant shell and the problem might
-    occur in other Vim scripts as well.
-    One solution is to add a similar block to the top of .vimrc:
-
-        if $SHELL =~ 'bin/fish'
-            set shell=/bin/sh
-        endif
+    See |slimv-configuration| below on how to do this.
 
 
 Uninstallation:
 
-  - Exit all Vim instances and exit from the REPL server terminal window.
+  - Exit all Vim instances and exit from the SWANK server.
   - Delete the files that were copied to the vimfiles directory during
     installation (see list of files above).
 
 
 ===============================================================================
-CUSTOMIZATION                                             *slimv-customization*
+CONFIGURATION                                             *slimv-configuration*
 
 |slimv-options|              Options
-|slimv-templates|            Templates
 |slimv-keyboard|             Keyboard mappings
 
 -------------------------------------------------------------------------------
 For the Paredit options please visit |paredit-options|.
 For the Swank options plese visit |swank-configuration|.
 
+|g:slimv_balloon|            Specifies if tooltips are on.
+
 |g:slimv_browser_cmd|        If nonempty, this command is used to open the
                              Common Lisp Hyperspec. 
 
 |g:slimv_cljapi_user_root|   Base URL for the user defined Clojure API
                              extension.
 
-|g:slimv_client|             The whole OS command to start the Slimv client.
-                             Used for advanced customization, like changing
-                             the terminal emulator to use for the Lisp REPL.
-
 |g:slimv_ctags|              OS command to generate tags file.
 
 |g:slimv_echolines|          Echo only this number of lines from the form
 |g:slimv_package|            If nonzero, Slimv package/namespace handling is
                              switched on.
 
-|g:slimv_port|               TCP/IP port number to use in the Slimv client-
-                             server communication.
-
 |g:slimv_python|             Path for the Python interpreter.
 
-|g:slimv_repl_dir|           Directory path for the Lisp REPL buffer file.
-
-|g:slimv_repl_file|          Filename without path for the REPL buffer file.
-
-|g:slimv_repl_open|          If nonzero, Slimv opens the Lisp REPL buffer
-                             inside Vim when the server is started.
-
 |g:slimv_repl_split|         Open the Lisp REPL buffer in a split window
                              or in a separate buffer.
 
 
 |g:slimv_repl_wrap|          Set wrap mode for the REPL buffer.
 
-|g:slimv_swank|              Indicates the usage of the SWANK client.
-                             Please find additional SWANK related options
-                             in |swank.txt|.
+|g:slimv_simple_compl|       Use simple completion instead of fuzzy completion.
+
+|g:slimv_swank_clojure|      Command used to start the Clojure SWANK server.
+
+|g:slimv_swank_cmd|          Command used to start the Lisp SWANK server.
+
+|g:slimv_swank_scheme|       Command used to start the Scheme SWANK server.
+
+|g:slimv_timeout|            Timeout defined for starting up or connecting
+                             to the SWANK server.
 
 |g:slimv_updatetime|         Alternative value for 'updatetime' during REPL
                              refresh.
 
+|g:swank_block_size|         SWANK connection output buffer size.
+
+|g:swank_host|               Host name or IP address of the SWANK server.
+
+|g:swank_port|               Port number of the SWANK server.
+
 
 Note: Most options require to restart the Vim session when modified.
 
 Example:
     let g:slimv_impl = 'sbcl'
 
-                                                                 *g:slimv_port*
-The default port used by Slimv is 5151. If this port is used by another
-program then set this variable to a free port number.
-It is also possible to run multiple REPLs from multiple Vim processes, just
-set a different port number for each Vim instance.
-Example:
-    let g:slimv_port = 10101
-
-There is a separate port definition in Slimv which sets the port number to
-use for the SWANK server, see |g:swank_port| for details.
-
-                                                               *g:slimv_client*
-Note: Used only when SWANK client is not enabled.
-
-You may want to use a shell frontend other then the default one (cmd.exe
-on Windows, xterm on Linux) or put additional command line parameters
-for starting the server.
-In this case you can omit the variables above and use g:slimv_client instead.
-This is the complete command that is used to start the client. If not set
-by the user, this is automatically built from the variables above.
-
-The command format is the following (items in [] are optional):
-    <python> <slimv> [-p <port>] -r "<server_cmd>"
-Where:
-    <python>       is the command to start the Python interpreter
-    <slimv>        is the path of slimv.py
-    <port>         is the port number to use (if other than default)
-    <server_cmd>   is the command to start the server
-
-The format of <server_cmd> is the following (please remember to enclose the
-whole command in double quotes, as this will be passed as one parameter
-to the client):
-    [<terminal>] <python> <slimv> -l <lisp> -s
-Where:
-    <terminal>     is the command to open a new terminal window
-    <python>       is the command to start the Python interpreter
-    <slimv>        is the path of slimv.py
-    <lisp>         is the command to start the Lisp REPL
-You can also pass the following shortcuts in <server_cmd>:
-    @p             equals <python>
-    @s             equals <slimv>
-    @@             use it if you need to insert an @ character
-    \"             use it to insert a " character
-So <server_cmd> can be rewritten in this shorter form:
-    [<terminal>] @p @s -l <lisp> -s
-
-The reason behind the duplication of the <python> and <slimv> part is that
-you may want to start the server/REPL in a shell frontend that needs
-special command line options. For example on Windows I highly recommend
-to use Console (http://sourceforge.net/projects/console/) which is greatly
-configurable and you also get usable select/copy/paste functions.
-
-Note: Remember to escape with a \ all " characters that are supposed to be
-      inside a command line argument, otherwise the argument will be split
-      by the shell.
-
-Example to start the Slimv server via Console on Windows:
-
-  let g:slimv_client = 
-  \ 'python slimv.py -p 5152 -r "console -r \"/k @p @s -l clisp -s\""'
-
-So the server will be started as if we typed at the command line:
-
-  console -r "/k python slimv.py -l clisp -s"
-
-A similar situation is if you want to use a terminal program other than
-xterm on Linux (e.g. Konsole). A typical g:slimv_client setup can be on
-Linux for xterm:
-
-  let g:slimv_client =
-  \ 'python ~/.vim/plugin/slimv.py -r "xterm -T Slimv -e @p @s -l clisp -s"'
-
-And this can be for Konsole:
-
-  let g:slimv_client =
-  \ 'python ~/.vim/plugin/slimv.py -r "konsole -T Slimv -e @p @s -l clisp -s"'
+                                                            *g:slimv_swank_cmd*
+                                                        *g:slimv_swank_clojure*
+                                                         *g:slimv_swank_scheme*
+Slimv tries to autodetect your Python/Lisp/SWANK installation.
+If the location for the SWANK server is not identified by the script, or you
+want to use a different command for starting the SWANK server, then you may
+want to customize the g:slimv_swank_cmd (general) and g:slimv_swank_clojure
+(Clojure specific) and g:slimv_swank_scheme (Scheme specific) options in your
+.vimrc file.
+Enter a Vim command here that spawns a detached process that runs the SWANK
+server of your choice. It is important to use a Vim command here that returns
+immediately and does not wait for the termination of the detached process,
+so begin the command with !start on Windows...:
+
+    let g:slimv_swank_cmd = '!start "c:\Program Files\Lisp Cabinet\bin\ccl\wx86cl.exe" -l "c:\Program Files\Lisp Cabinet\site\lisp\slime\start-swank.lisp"'
+    let g:slimv_swank_clojure = '!start "c:\clojurebox\swank-clojure\src\start-swank.bat"'
+
+...and end the command with an & on Linux:
+
+    let g:slimv_swank_cmd = '! xterm -e sbcl --load /usr/share/common-lisp/source/slime/start-swank.lisp &'
+    let g:slimv_swank_clojure = '! xterm -e lein swank &'
+
+On OS X the following or similar command may be used (but sometimes the above
+Linux xterm command also works):
+
+    let g:slimv_swank_cmd = '!osascript -e "tell application \"Terminal\" to do script \"sbcl --load ~/.vim/slime/start-swank.lisp\""'
+    let g:slimv_swank_clojure = '!osascript -e "tell application \"Terminal\" to do script \"cake swank\""'
+
+These are examples only, the Lisp command and the path to the SWANK server
+may need to be changed in the command depending on the actual configuration.
+
+It is also possible to run the SWANK server manually prior running Vim.
+Slimv detects if a SWANK server is running and connects to it at the first
+evaluation request.
+
+Note: It is recommended to pass
+    :dont-close t
+for the swank:create-server function call in the SWANK startup procedure.
+This makes a permanent SWANK server that listens continuously. Otherwise
+each time the SWANK connection is lost, the SWANK server needs to be
+restarted again.
+Some SWANK features (like Xref) require the load of the contributed modules,
+so it is recommended to pass
+    :load-contribs t
+for the swank-loader:init function call in the SWANK strartup procedure.
+Example startup script:
+
+(load (merge-pathnames "swank-loader.lisp" *load-truename*))
+
+(swank-loader:init :delete nil
+                   :reload nil
+                   :load-contribs t)
+
+(swank:create-server :port 4005
+                     :coding-system "iso-latin-1-unix"
+                     :dont-close t)
+
+
+                                                           *g:swank_block_size*
+By default the SWANK server connection output buffer size is 4 or 8 kbytes.
+All the data sent by the SWANK server is divided into this size blocks, so
+if the SWANK server is sending large amount of data then this may result in
+high number of data blocks sent, which may slow down Slimv. For greater
+performance you may want to increase the block size, e.g. to 64 kbytes:
+    let g:swank_block_size = 65536
+
+                                                                 *g:swank_host*
+Host name or IP address of the SWANK server. Default value is 'localhost'.
+The SWANK server may run on a remote machine, but currently only unencrypted
+plain socket communication is supported, no SSH or whatsoever.
+Please note that if the SWANK server is on a remote machine then Slimv is
+unable to start it, so you need to run the SWANK server manually.
+
+                                                                 *g:swank_port*
+The SWANK server is connected to port 4005 by default. This can be changed
+using the g:swank_port option.
+
+                                                              *g:slimv_timeout*
+There is a 20 second timeout defined for starting up or connecting to the
+SWANK server. This timeout can be changed via the g:slimv_timeout option.
+Please note that the very first startup of the SWANK server may take more time
+than the subsequent startups, so it is not recommended to make this timeout
+too low.
 
                                                                 *g:slimv_ctags*
 It is possible to generate tags file from within Vim. By default Slimv assumes
 the .html extension (on Windows) or returned by the Python webbrowser package
 (on Linux) is used to start the browser.
 
-                                                             *g:slimv_repl_dir*
-Directory path for the Lisp REPL buffer file. By default this is a directory
-for temporary files, something like /tmp/ on Linux or
-"C:\Documents and Settings\Username\Local Settings\Temp\" on Windows.
-The directory name must end with the pathname separator (/ or \).
-See also |g:slimv_repl_file|.
-
-                                                            *g:slimv_repl_file*
-The Lisp REPL output is written to a temporary file by the Slimv server.
-|g:slimv_repl_file| defines the filename part of the REPL output file without
-the directory path. The complete REPL filename is built from
-|g:slimv_repl_dir| and |g:slimv_repl_file|.
-
-                                                            *g:slimv_repl_open*
-Slimv opens the Lisp REPL buffer inside Vim by default when the Slimv server
-is started, so there exist actually two REPL-s with the same contents:
-one inside a Vim buffer and another one as a separate terminal window.
-The reason behind this is that the simulation is not perfect, which is caused
-by the lack of asynchronous update possibilities in Vim. Sometimes the REPL
-buffer is not perfectly updated, this is the case for example when a Lisp
-program is running too long and it has infrequent outputs only.
-Slimv refreshes the REPL buffer at every keystroke or when the user doesn't
-press a key for the time specified with 'updatetime'. It is also possible
-to manually refresh the REPL buffer. The default value for 'updatetime' is
-4 secs (=4000 ms), in cases when more precise refreshing is needed you can
-lower the 'updatetime' option, e.g. to one second (=1000 ms):
-    set updatetime=1000
-However, it is not recommended to set this to a much lower value.
-Optionally one may check the output of the separate REPL window.
-The |g:slimv_repl_open| = 0 option can be used to disable the built-in REPL
-buffer, so that only the separate REPL window is opened.
-
                                                            *g:slimv_repl_split*
 Open the Lisp REPL buffer in a split window or in a separate buffer in Vim.
-Used only when |g:slimv_repl_open| is nonzero.
 The default is to use split window. If you prefer having REPL being in a hidden
 buffer then set this option to zero. This way the REPL buffer will be opened
 at the first evaluation, but any subsequent evaluation will be performed
 silently, with the REPL buffer kept hidden.
 
 It is also possible to define the desired split direction. The following
-values may be used for |g:slimv_repl_open|:
+values may be used for |g:slimv_repl_split|:
 
     0: no split
     1: horizontal split above (default)
 If this option is set to zero then no line is echoed at all, if set to -1
 then all lines are always echoed.
 
+                                                              *g:slimv_balloon*
+Specifies if describe tooltips are on (see |swank-describe|).
+
+                                                         *g:slimv_simple_compl*
+If set to 1, swank:simple-completion is used. By default the fuzzy completion
+is active, so that "mvb<TAB>" expands to "multiple-value-bind"
+(see |swank-completions|).
+
                                                             *g:slimv_clhs_root*
                                                           *g:slimv_cljapi_root*
                                                          *g:slimv_javadoc_root*
 Remember to insert a backslash at the beginning of each additional line of a
 multi-line Vim command.
 
-
--------------------------------------------------------------------------------
-                                                              *slimv_templates*
-
-Many Slimv commands are performed by creating a special Lisp form from the
-selected symbol (or list) and send it to the REPL for execution.
-Slimv defines various templates to build these special Lisp forms.
-You can override them to suit your needs. Use %1 for substituting the selected
-symbol's name or the selected list.
-Here follows a list of the templates defined in Slimv.
-
-                                                      *g:slimv_template_pprint*
-Lisp form built when issuing the 'Pprint' command.
-Example:
-    let g:slimv_template_pprint = '(dolist (o %1)(pprint o))'
-
-                                                    *g:slimv_template_undefine*
-Note: Used only when SWANK client is not enabled.
-
-Lisp form built when issuing the 'Undefine' command.
-Example:
-    let g:slimv_template_undefine = '(fmakunbound (read-from-string "%1"))'
-
-                                                    *g:slimv_template_describe*
-Note: Used only when SWANK client is not enabled.
-
-Lisp form built when issuing the 'Describe' command.
-Example:
-    let g:slimv_template_describe = '(describe (read-from-string "%1"))'
-
-                                                       *g:slimv_template_trace*
-Note: Used only when SWANK client is not enabled.
-
-Lisp form built when issuing the 'Trace' command.
-Example:
-    let g:slimv_template_trace = "(trace %1)"
-
-                                                     *g:slimv_template_untrace*
-Note: Used only when SWANK client is not enabled.
-
-Lisp form built when issuing the 'Untrace' command.
-Example:
-    let g:slimv_template_untrace = "(untrace %1)"
-
-                                                     *g:slimv_template_profile*
-Lisp form built when issuing the 'Profile' command.
-Example:
-    let g:slimv_template_profile = "(mon:monitor %1)"
-
-                                                   *g:slimv_template_unprofile*
-Lisp form built when issuing the 'Unprofile' command.
-Example:
-    let g:slimv_template_unprofile = "(mon:unmonitor %1)"
-
-                                               *g:slimv_template_unprofile_all*
-Lisp form built when issuing the 'Unprofile All' command.
-Example:
-    let g:slimv_template_unprofile_all = "(mon:unmonitor)"
-
-                                               *g:slimv_template_show_profiled*
-Lisp form built when issuing the 'Show Profiled' command.
-Example:
-    let g:slimv_template_show_profiled = "(pprint mon:*monitored-functions*)"
-
-                                              *g:slimv_template_profile_report*
-Lisp form built when issuing the 'Profile Report' command.
-Example:
-    let g:slimv_template_profile_report = "(mon:report-monitoring)"
-
-                                               *g:slimv_template_profile_reset*
-Lisp form built when issuing the 'Profile Reset' command.
-Example:
-    let g:slimv_template_profile_reset = "(mon:reset-all-monitoring)"
-
-                                                 *g:slimv_template_disassemble*
-Lisp form built when issuing the 'disassemble' command.
-Example:
-    let g:slimv_template_disassemble = "(disassemble #'%1)"
-
-                                                     *g:slimv_template_inspect*
-Note: Used only when SWANK client is not enabled.
-
-Lisp form built when issuing the 'inspect' command.
-Example:
-    let g:slimv_template_inspect = "(inspect %1)"
-
                                                      *g:slimv_template_apropos*
 Lisp form built when issuing the 'apropos' command.
 Example:
     let g:slimv_template_apropos = '(apropos "%1")'
 
-                                                 *g:slimv_template_macroexpand*
-Note: Used only when SWANK client is not enabled.
-
-Lisp form built when issuing the 'macroexpand-1' command, after "defmacro"
-string is replaced with "macroexpand-1".
-Example:
-    let g:slimv_template_macroexpand = '(pprint %1)'
-
-                                             *g:slimv_template_macroexpand_all*
-Note: Used only when SWANK client is not enabled.
-
-Lisp form built when issuing the 'macroexpand-all' command, after "defmacro"
-string is replaced with "macroexpand".
-Example:
-    let g:slimv_template_macroexpand_all = '(pprint %1)'
-
-                                                *g:slimv_template_compile_file*
-Lisp form built when issuing the 'compile-file' command.
-Example:
-    let g:slimv_template_compile_file = '(compile-file "%1")'
-
-
 -------------------------------------------------------------------------------
                                                                *slimv_keyboard*
 
     Edit commands (Insert mode):
     <C-X>0           Close Form
     <Tab>            Complete Symbol
-    <Space>          Function Arglist (only when using SWANK client)
+    <Space>          Function Arglist
 
     Edit commands (Normal mode):
     ,)      ,tc      Close Form
     ,T      ,du      Untrace All
     ,l      ,dd      Disassemble
     ,i      ,di      Inspect (inspects in frame when in SLDB)
-    ,a      ,da      Abort (only when using SWANK client)
-    ,q      ,dq      Quit to Toplevel (only when using SWANK client)
-    ,n      ,dc      Continue (only when using SWANK client)
+    ,a      ,da      Abort
+    ,q      ,dq      Quit to Toplevel
+    ,n      ,dc      Continue
     ,H      ,dl      List Threads
     ,K      ,dk      Kill Thread
     ,G      ,dg      Debug Thread
     ,F      ,cf      Compile File
     ,R      ,cr      Compile Region
 
-    Cross Reference commands (only when using SWANK client):
+    Cross Reference commands
     ,xc     ,xc      Who Calls
     ,xr     ,xr      Who References
     ,xs     ,xs      Who Sets
     REPL menu commands:
     ,.      ,rs      Send Input
     ,/      ,ro      Close and Send Input
-    ,g      ,rp      Set Package (only when using SWANK client)
+    ,g      ,rp      Set Package
     <C-C>   <C-C>    Interrupt Lisp Process
     ,<Up>   ,rp      Previous Input
     ,<Down> ,rn      Next Input
 
 
 ===============================================================================
-USAGE                                                             *slimv-usage*
-
-After proper installation start Vim and load a *.lisp source file into a
-buffer. When the first Slimv command is entered (either from the menu or
-via keyboard shortcut or entering a :call Slimv...() at the Vim command line)
-then Slimv checks if the server/REPL runs and starts it if nedeed.
-When the server is running, the Slimv commands send the appropriate Lisp
-forms to the server/REPL for processing. That's it.
-
-All you need to know then is the list of possible Slimv commands, how to
-enter them and under what conditions.
-
-It is possible to interrupt a running Lisp program by pressing Ctrl-C,
-at least in some Lisp implementations, like CLISP (does not work for example
-with SBCL).
-In Clojure Ctrl-C exits the REPL by default, but it is possible to change this
-behaviour via the add-break-thread! function:
-    user=> (use 'clojure.contrib.repl-utils)
-    nil
-    user=> (add-break-thread!)
-Then pressing Ctrl-C results in a SIGINT exception in the current thread.
-This may however make bad things to your JVM, so use it with caution.
-
-To end the Lisp session press EOF (Ctrl-D on Linux, Ctrl-Z on Windows)
-in the Lisp REPL window. After exiting the REPL it is possible to open
-a new one from Vim the same way as before.
+SWANK FEATURES                                                    *slimv-swank*
+
+The following major SLIME (SWANK) features are implemented in Slimv.
+For a complete reference of SWANK functions implemented see |swank-functions|.
+
+|swank-eval|                 Evaluation
+|swank-interrupt|            Interrupt Lisp process
+|swank-restarts|             SLDB: Invoke restarts
+|swank-backtrace|            SLDB: Display backtrace with locals
+|swank-arglist|              Function argument list in status line
+|swank-describe|             Describe symbol in tooltip
+|swank-completions|          List of possible symbol completions
+|swank-inspect|              Inspector
+|swank-trace|                Trace function
+|swank-profile|              Profiler
+|swank-xref|                 Cross Reference
+|swank-quickfix|             Compiler errors in quickfix list
+|swank-functions|            SWANK functions implemented
+
+-------------------------------------------------------------------------------
+EVALUATION                                                         *swank-eval*
+
+There are various methods for evaluating an s-expression in the SWANK server.
+It is possible to eval the current top level form, the current subform, the
+visually selected area, or the whole buffer. Consult the "Evaluation commands"
+section in |slimv_keyboard| for the possible functions with their respective
+keyboard shortcuts.
+
+
+If debugger is activated and the cursor is placed on a frame line in the
+Backtrace section, then the Interactive-Eval command evaluates expressions
+in the scope of the given frame ("eval-in-frame").
+
+
+-------------------------------------------------------------------------------
+INTERRUPT LISP PROCESS                                        *swank-interrupt*
+
+It is possible to interrupt a running Lisp or Clojure process by selecting
+the Interrupt-Lisp-Process menu item in the REPL or Slimv/Repl submenu,
+or by pressing the keyboard shortcut <Leader>i.
+It is also possible to map the Ctrl-C shortcut in normal mode to perform the
+interrupt, but this may interfere with the "Copy to clipboard" function
+especially on Windows. Here is how to do it:
+
+    noremap  <silent> <C-C>      :call SlimvInterrupt()<CR> 
+
+When a Lisp process is interrupted, we are dropped in SLDB (SLime DeBugger)
+and the list of restarts (see |swank-restarts|) and calling frame stack
+(see |swank-backtrace|) is displayed.
+It is possible to inspect variables (see |swank-inspect|) and continue
+or break program execution by selecting the appropriate restart.
+It is also possible to change the value of variables or redefine functions
+before resuming execution.
+
+
+-------------------------------------------------------------------------------
+INVOKE RESTARTS                                                *swank-restarts*
+
+In case of an error or when the Lisp process is interrupted Slimv presents
+the Swank debugger (SLDB) buffer. SLDB displays the condition and the list of
+possible restarts, each line startin with the restart identifier, for example:
+
+DIVISION-BY-ZERO detected
+   [Condition of type DIVISION-BY-ZERO]
+
+Restarts:
+  0: [RETRY] Retry SLIME REPL evaluation request.
+  1: [*ABORT] Return to SLIME's top level.
+  2: [ABORT-BREAK] Reset this thread
+  3: [ABORT] Kill this thread
+
+
+If you press Enter in normal mode on a restart line then the given restart
+is invoked.
+The most frequently used restarts have the following shortcuts defined:
+
+    ,a      Abort
+    ,q      Quit To Toplevel
+    ,n      Continue
+
+
+-------------------------------------------------------------------------------
+DISPLAY BACKTRACE                                             *swank-backtrace*
+
+The Swank debugger (SLDB) is presented in a separate dedicated buffer.
+Below the Restarts section SLDB displays the backtrace for the calling frames,
+each line starting with the frame identifier, for example:
+
+Backtrace:
+  0: (CCL::%FIXNUM-TRUNCATE #<Unknown Arguments>)
+  1: (/ 1 0)
+  2: (NIL #<Unknown Arguments>)
+  3: (CCL::CALL-CHECK-REGS / 1 0)
+  4: (CCL::CHEAP-EVAL (/ 1 0))
+  5: (SWANK::EVAL-REGION "(/ 1 0)")
+
+
+If you press Enter in normal mode on a frame line then frame information
+with the local variable bindings and source location information for that frame
+are displayed in a fold. Pressing Enter again toggles the fold close/open.
+
+If you press Enter on a filename with source location information then Slimv
+opens the given file in a buffer at the specified location.
+
+Some commands have modified behaviour when used on a frame:
+
+    Interactive-Eval         Evaluates expressions in the scope of the frame.
+
+    Inspect                  Inspects objects within the scope of the frame.
+
+
+-------------------------------------------------------------------------------
+FUNCTION ARGUMENT LIST                                          *swank-arglist*
+
+When entering an s-expression in insert mode, each time a space is pressed
+after a non-whitespace character, then SWANK is requested for the function
+argument list for the current function. If the function is known by SWANK
+then the function prototype is displayed in the status line. The arglist is
+condensed in order to fit the status line, so for functions with many
+arguments the whole definition may not be visible. In this case use the
+Describe function for displaying the full function definition.
+
+Note: the function argument list is not displayed when Slimv is not
+connected to the SWANK server.
+
+
+-------------------------------------------------------------------------------
+DESCRIBE SYMBOL                                                *swank-describe*
+
+When you hover your mouse over a function's name then the function description
+is requested from SWANK and displayed in a tooltip, called balloonexpr in
+Vim terms. This functionality requires that Vim is compiled with the
++balloon_eval feature enabled.
+
+If you don't have +balloon_eval or want to get the description for a general
+symbol then it is possible to select the Describe-Symbol menu item from the
+Slimv/Documentation submenu, or press the <Leader>s keyboard shortcut,
+which then displays the symbol description in the Vim message area.
+
+Note: the symbol description is not displayed when Slimv is not connected
+to the SWANK server.
+
+
+-------------------------------------------------------------------------------
+COMPLETIONS                                                 *swank-completions*
+
+The Vim omni-completion function requests the possible completions for the
+symbol currently being entered from the SWANK server. The completion list
+is displayed in a popup menu.
+The keyboard shortcut for completion is <Tab>. This brings up the completions
+popup menu if there are multiple choices. In the popup menu subsequent <Tab>
+keypresses select the next possible completion.
+
+Option |g:slimv_simple_compl| determines whether simple or fuzzy completion
+is used. Default is fuzzy completion.
+
+Note: completions are not displayed when Slimv is not connected to the
+SWANK server. In this case the Hyperspec database is used for symbol lookup.
+
+
+-------------------------------------------------------------------------------
+INSPECTOR                                                       *swank-inspect*
+
+The Swank Inspector is presented in a separate buffer. In the Inspect buffer
+the Enter key is remapped in normal mode for traversing the inspector output.
+
+When pressing Enter on the top line starting with 'Inspecting' then the
+currently inspected value is reloaded.
+
+When pressing Enter on a line starting with <nn> (where nn is the action
+identifier) then nn-th action is called.
+
+When pressing Enter on a line starting with [nn] (where nn is the part
+identifier) then nn-th part is inspected.
+
+When pressing Enter on the last line starting with [<<] or pressing <Backspace>
+then the inspector is popped up one level, or if this was the topmost level
+then Slimv exits the Inspector.
+Pressing <Leader>q also exits the Inspector.
+
+
+If debugger is activated and the cursor is placed on a frame line in the
+Backtrace section, then the Inspect command inspects objects in the given
+frame. It means that it is possible to examine the value of local variables
+within the scope of the given frame ("inspect-in-frame").
+
+
+-------------------------------------------------------------------------------
+TRACE                                                             *swank-trace*
+
+It is possible to tell the SWANK server to trace or untrace functions.
+There are some subtle differences in the trace handling with or
+without SWANK.
+
+For the trace handling without SWANK please check options
+|g:slimv_template_trace| and |g:slimv_template_untrace|.
+
+When using the SWANK server the Trace command toggles tracing for the
+selected function. In this case there is no Untrace command, but there is
+an Untrace-All command, which completely switches off tracing.
+This complies with the SWANK tracing functionality.
+
+
+-------------------------------------------------------------------------------
+PROFILER                                                        *swank-profile*
+
+Slimv supports SLIME's profiler. It is possible to toggle profiling on a
+function, on a set of functions whose name contains a given substring, or
+unprofile all functions. You may query the profiler for the list of profiled
+functions. After the profiling session it is possible to display the profiler
+report. Upon selecting Reset all counters are cleared, so that a new
+profiling session may be started.
+
+
+-------------------------------------------------------------------------------
+CROSS REFERENCE                                                    *swank-xref*
+
+SLIME's cross reference functionality can be used to list the functions
+calling a specific function, the list of functions called from a specific
+function, and other variable, macro, etc. references.
+Please note that not all Lisp implementations support the xref functionality.
+
+
+-------------------------------------------------------------------------------
+QUICKFIX                                                       *swank-quickfix*
+
+The compiler error messages are fed into Vim's quickfix list, as well as
+printed in the REPL buffer. Enter the :cw command to open the quickfix window.
+Use :cn and :cp to jump to the next and previous error location, use :cr to
+rewind to the first error.
+Consult |quickfix| for details on using the quickfix functionality.
+
+
+-------------------------------------------------------------------------------
+SWANK FUNCTIONS                                               *swank-functions*
+
+This section contains a reference for the Emacs/SLIME/SWANK functions
+currently implemented in the Slimv SWANK client.
+
+  :emacs-interrupt
+  :emacs-pong
+  :emacs-return-string
+  :indentation-update
+  swank:compile-file-for-emacs
+  swank:compile-string-for-emacs
+  swank:connection-info
+  swank:create-repl
+  swank:debug-nth-thread
+  swank:describe-function
+  swank:disassemble-form
+  swank:eval-string-in-frame
+  swank:frame-locals-and-catch-tags
+  swank:frame-source-location
+  swank:fuzzy-completions
+  swank:init-inspector
+  swank:inspect-in-frame
+  swank:inspect-nth-part
+  swank:inspector-call-nth-action
+  swank:inspector-pop
+  swank:invoke-nth-restart-for-emacs
+  swank:kill-nth-thread
+  swank:list-threads
+  swank:listener-eval
+  swank:load-file
+  swank:operator-arglist
+  swank:profile-by-substring
+  swank:profile-report
+  swank:profile-reset
+  swank:profiled-functions
+  swank:quit-inspector
+  swank:set-package
+  swank:simple-completions
+  swank:sldb-abort
+  swank:sldb-continue
+  swank:swank-macroexpand-1
+  swank:swank-macroexpand-all
+  swank:swank-require
+  swank:swank-toggle-trace
+  swank:throw-to-toplevel
+  swank:toggle-profile-fdefinition
+  swank:undefine-function
+  swank:unprofile-all
+  swank:untrace-all
+  swank:xref
+  swank-backend:frame-call
 
 
 ===============================================================================
 LISP REPL                                                          *slimv-repl*
 
 The Lisp REPL is displayed as a separate terminal window and also inside a
-Vim buffer. The Lisp REPL buffer is opened when the Slimv server is started.
+Vim buffer. The Lisp REPL buffer is opened when the SWANK server is started.
 The REPL buffer is a more or less regular Vim buffer, all Vim keybindings and
 commands can be used here as well.
 
 
 Vim has a built-in support for Lisp, however it has no Clojure support by
 default. As Clojure is a Lisp dialect, Slimv simply reuses Vim's Lisp syntax
-and indent plugins for Clojure. It this does not suit your needs, then it is
+and indent plugins for Clojure. If this does not suit your needs, then it is
 possible to download and install a separate Clojure plugin parallel to Slimv.
 
 In order to launch the Clojure REPL the variable |g:slimv_lisp| must be
 
 
 ===============================================================================
-PROFILING                                                     *slimv-profiling*
-
-The SWANK client has the same profiler support as SLIME.
-
-If not using the SWANK client, then Slimv is still capable of utilizing SBCL's
-built-in profiler, and also the same monitoring/profiling package
-(metering.lisp) that is used by SLIME.
-
-SBCL's profiler is ready to use by just starting the Lisp REPL.
-In order to use SLIME's profiler with CLISP it first must be compiled and
-loaded into a running REPL. Perform this with the 'Load-Profiler' command.
-If the compilation was successful then Slimv is ready to profile.
-
-Use the 'Profile' command to select functions for profiling, 'Unprofile' to
-deselect specific functions or 'Unprofile All' to deselect all functions.
-Obtain a list of profiled functions with 'Show Profiled'.
-use 'Profile-Report' to display profiling results.
-Reset profiling counters with 'Profile-Reset'.
-
-When the REPL is restarted, the profiler needs to be reloaded (only in case
-of CLISP): select the 'Load-Profiler' command again (this re-compiles
-metering.lisp).
-
-It is possible to override the default profile commands via the following
-templates (see |slimv_templates|):
-
-    |g:slimv_template_profile|
-    |g:slimv_template_unprofile|
-    |g:slimv_template_unprofile_all|
-    |g:slimv_template_show_profiled|
-    |g:slimv_template_profile_report|
-    |g:slimv_template_profile_reset|
-
-
-===============================================================================
 HYPERSPEC AND COMPLETION                                      *slimv-hyperspec*
 
 Slimv contains Common Lisp Hyperspec, Clojure API and JavaDoc symbol databases.
 The SWANK client requests simple or fuzzy completion from the SWANK server,
 see |swank-completions| for details.
 
-Without the SWANK client Slimv uses the Hyperspec symbol database for symbol
-name completion, via Vim's omni-completion feature (if it is enabled and
-'omnifunc' is not defined already to something else).
+If the SWANK server is not connected, then Slimv uses the Hyperspec symbol
+database for symbol name completion, via Vim's omni-completion feature
+(if it is enabled and 'omnifunc' is not defined already to something else).
 Start to enter the symbol in Insert mode, then at some point press the
 <C-X><C-O> (omni-complete) key combination or select the 'Complete Symbol'
 function. The first match in the symbol database is inserted at the cursor
 The indentation is also done via the default lisp.vim indent plugin, or an
 optionally installed Clojure indent plugin, just like for the syntax
 highlighting.
-When using the SWANK client and it is connected to the server, then indentation
-information is fetched from the SWANK server. This allows special indentation
-methods, e.g. when the given macro has an &body argument then it is indented
-by 2 spaces (instead of indenting the second argument below the first one).
+When the SWANK client is connected to the server, then indentation information
+is fetched from the SWANK server. This allows special indentation methods,
+e.g. when the given macro has an &body argument then it is indented by 2 spaces
+(instead of indenting the second argument below the first one).
 
 There are some built-in Vim reindentation commands that may come very handy
 when editing Lisp files. One can define a custom key mapping for any of them,
 - Q: Why is this plugin called 'Slimv'?
 - A: Because it is trying to mimic the popular Emacs extension 'SLIME'.
      In SLIME 'E' stands for 'Emacs', so here it is replaced with 'V' as Vim.
-     The most recent plugin version also contains a SWANK client, so Slimv's
-     functionality is getting closer to SLIME.
+     The plugin is actually a SWANK (TCP server for Emacs) client.
      To tell the truth, first I gave the name 'Slimvim' to the plugin but
      then I found an (already abandoned) project called 'Slim-Vim' and I did
      not want to interfere with it.
      in Vim, but this may change in the future.
 
 - Q: How does Slimv work?
-- A: Slimv consists of three parts by the original concept:
-     Vim plugin, client and server.
-     The Slimv server is a swank-like server that embeds a console Lisp REPL
-     via pipes, catching all REPL input/output.
-     The Slimv client interfaces with the server and is responsible
-     for sending Lisp commands to the Lisp REPL.
-     The Vim plugin is translating editor commands to Lisp commands to be
-     sent to the server by the client.
-     So the dataflow is like this:
-     Vim -> Vim plugin -> Slimv client -> Slimv server -> Lisp REPL
-     The plugin resides in 'slimv.vim', the client and the server both
-     located in 'slimv.py'.
-
-     Slimv also contains a SWANK client that is able to communicate a
-     running SWANK server, just as it is done by Emacs with SLIME.
-     The SWANK output is regularly polled via the socket connection.
+- A: Slimv is a SWANK client that is able to communicate with a running
+     SWANK server, just as it is done by Emacs with SLIME.
+     The SWANK output is regularly polled via the socket connection and
+     interpreted in the REPL buffer opened in Vim.
      The SWANK client is located in 'swank.py'.
 
-- Q: There is no Slimv server opened when I evaluate a form in Vim.
-- A: There may be many reasons for that. Try to run the server manually by
-     opening a new terminal console window and running this command:
-         {python command} {slimv.py path} -l {lisp command} -s
-     where
-         {python command} is the command to start the Python interpreter,
-         {slimv.py} is the path for slimv.py (usually in Vim's ftplugin dir),
-         {lisp command} is the command to start Lisp (or Clojure).
-     Examples:
-         c:\python24\python "c:\Program Files\Vim\vimfiles\ftplugin\slimv.py" -l c:\clisp\clisp.exe -s
-         python /home/username/.vim/ftplugin/slimv.py -l sbcl -s
-     Please remember to enclose each parameter in double quotes if that
-     parameter contains spaces.
+- Q: But there was a non-swank functionality built in Slimv, where is it now
+     and how can I use it?
+- A: It has been removed since version 0.9.0, because the development focuses
+     on providing a fully functional SWANK client, so the non-swank functionality
+     was not maintained. If you want the old behaviour then fetch plugin
+     version 0.8.6 and set g:slimv_swank to 0 in your vimrc file.
+
+- Q: There is no SWANK server opened when I evaluate a form in Vim.
+- A: There may be many reasons for that. Try to run the SWANK server manually,
+     Slimv detects if a SWANK server is running and is able to connect it.
+     Check if the port number matches in Slimv and the SWANK server.
+     Verify the SWANK server command autodetected by Slimv:
+         :echo SlimvSwankCommand()         
      Also check the following Slimv variables in Vim, maybe they are not
      correctly autodetected and you need to override them in your .vimrc:
          :echo g:slimv_python
          :echo g:slimv_lisp
-         :echo g:slimv_client         
+         :echo g:slimv_swank_cmd   (or g:slimv_swank_clojure for Clojure)
 
 - Q: The Slimv plugin is not loaded for a .lisp (or .clj, etc) file.
 - A: Filetype plugins should be enabled, check it via the :filetype command.
      loading of the Slimv scripts.
 
 - Q: Why is SLIME functionality XYZ missing from Slimv?
-- A: There are two possible reasons:
-     1. The dataflow of Slimv is one-directional: from client to server.
-        There is no data sent back from the server to the client, so if a
-        functionality requires that Slimv reads data from REPL, then
-        currently it is not possible to implement it.
-     2. It is possible to implement it, but I did not (yet) do it.
-        Maybe future releases will contain it. All feature requests are
-        welcome.
-
-- Q: Why is the default Slimv port number 5151?
-- A: Hint: what roman numerals are 5,1,5,1? Bingo: VI, doubled.
+- A: Not all SLIME functions are implemented in the SWANK client, however
+     the list of these functions keep growing.  Maybe future releases will
+     contain it. All feature requests are welcome.
 
 - Q: What is the version numbering concept?
 - A: <major version>.<minor version>.<bugfix release>, where:
 ===============================================================================
 CHANGE LOG                                                    *slimv-changelog*
 
+0.9.0  - Separate buffers for SLDB and Inspector.
+       - Toggle frame information in SLDB buffer by pressing Enter.
+       - Look up source when pressing Enter on filename with location in SLDB.
+       - Added option g:swank_block_size to override Swank output buffer size
+         (thanks to stassats on #lisp and Philipp Marek).
+       - Removed old non-swank functionality.
+       - Removed option g:slimv_repl_open.
+       - Paredit: new mappings [[ and ]] for previous and next defun.
+       - Bugfix: various refresh problems (thanks to Philipp Marek).
+       - Bugfix: disable debug mode when reconnecting Swank (by Philipp Marek).
+       - Bugfix: display multi-line debug condition and frame source location,
+         quote characters in compile (by Philipp Marek).
+       - Bugfix: use proper SLDB level when invoking restart (by Philipp Marek).
+       - Bugfix: restore all lisp keyword characters in iskeyword.
+       - Bugfix: indentation of defgeneric.
+       - Bugfix: use proper filename and location when compiling defun or region.
+       - Bugfix: buffer corruption when re-triggering timer in insert mode.
+       - Bugfix: <End> moved cursor to the right edge of screen in REPL buffer
+         when virtualmode=all.
+
 0.8.6  - Handle cl:in-package, common-lisp:in-package (thanks to Philipp Marek).
        - Added option g:swank_host to allow connecting to remote Swank server.
        - Autodetection of Cake for Clojure (thanks to Chris Cahoon).
 - Vim register "s is used for all form selections, so its original content is
   destroyed.
 - Vim mark 's is used to mark the end of the REPL buffer, i.e. the beginning
-  of the "command line".
+  of the "command line", also the for the location of the current frame in
+  the SLDB buffer.
 - Needs Vim version 7.0 or above, because of the intensive use of lists.
 - Needs the same Python version that Vim is compiled against
 - It is not possible to run separate Lisp and Clojure REPL in the same
 TODO                                                               *slimv-todo*
 
 - Add missing SLIME functions to the SWANK client.
-- Separate SLDB/Inspector/etc buffers from the REPL buffer.
-- Allow connecting remote SWANK server (outside of localhost).
+- Continue separating other buffers (e.g. Threads) from the REPL buffer.
+- Allow connecting remote SWANK server (outside of localhost) via SSH.
 
 ===============================================================================
 CREDITS                                                         *slimv-credits*

doc/swank.txt

-*swank.txt*                    Slimv                 Last Change: 13 Aug 2011
-
-SWANK client for Slimv                                    *swank* *slimv-swank*
-                               Version 0.8.6
-
-The Superior Lisp Interaction Mode for Vim.
-Slimv contains a SWANK client that can communicate with a running SWANK server
-the same way as done by Emacs with SLIME.
-The SWANK client is part of Slimv, please find additional general purpose
-information about the plugin, like FAQ, changelog, credits, etc in |slimv.txt|.
-
-|swank-installation|         Installation
-|swank-configuration|        Configuration
-|swank-features|             Features
-|swank-functions|            SWANK functions implemented
-
-===============================================================================
-INSTALLATION                                               *swank-installation*
-
-  Required components:
-
-  - Vim 7.0 or newer installed with Python feature enabled.
-    This can be verified by the :ver command, look for the +python string.
-    It is recommended to have also the +balloon_eval feature for displaying
-    symbol descriptions in tooltip.
-  - Python installed.
-    Must be the same Python version that was Vim compiled against.
-    This can also be verified by the :ver command, look for the
-    -DDYNAMIC_PYTHON_DLL=\"pythonXX\" string, where XX is the required
-    Python version.
-  - Lisp or Clojure or MIT Scheme (Linux only) installed.
-    Any Lisp implementation is OK that has SLIME support.
-
-  The bundle version of Slimv also contains SLIME (in fact the SWANK server
-  part of SLIME) and Swank Clojure. If you intend to use your own version of
-  SLIME, then you need to have your own SWANK server installed.
-  For example Clojure users might consider installing Leiningen and run the
-  SWANK server via 'lein swank', or use Cake via 'cake swank'.
-
-
-===============================================================================
-CONFIGURATION                                             *swank-configuration*
-
-                                                            *g:slimv_swank_cmd*
-                                                        *g:slimv_swank_clojure*
-                                                         *g:slimv_swank_scheme*
-  Slimv tries to autodetect your Python/Lisp/SWANK installation (please find
-  more details about the Python and Lisp autodetection and configuration in
-  |slimv-options|).
-  If the location for the SWANK server is not identified by the script, or you
-  want to use a different command for starting the SWANK server, then you may
-  want to customize the g:slimv_swank_cmd (general) and g:slimv_swank_clojure
-  (Clojure specific) and g:slimv_swank_scheme (Scheme specific) options in
-  your .vimrc file.
-  Enter a Vim command here that spawns a detached process that runs the SWANK
-  server of your choice. It is important to use a Vim command here that returns
-  immediately and does not wait for the termination of the detached process,
-  so begin the command with !start on Windows...:
-
-    let g:slimv_swank_cmd = '!start "c:\Program Files\Lisp Cabinet\bin\ccl\wx86cl.exe" -l "c:\Program Files\Lisp Cabinet\site\lisp\slime\start-swank.lisp"'
-    let g:slimv_swank_clojure = '!start "c:\clojurebox\swank-clojure\src\start-swank.bat"'
-
-  ...and end the command with an & on Linux:
-
-    let g:slimv_swank_cmd = '! xterm -e sbcl --load /usr/share/common-lisp/source/slime/start-swank.lisp &'
-    let g:slimv_swank_clojure = '! xterm -e lein swank &'
-
-  On OS X the following or similar command may be used (but sometimes the above
-  Linux xterm command also works):
-
-    let g:slimv_swank_cmd = '!osascript -e "tell application \"Terminal\" to do script \"sbcl --load ~/.vim/slime/start-swank.lisp\""'
-    let g:slimv_swank_clojure = '!osascript -e "tell application \"Terminal\" to do script \"cake swank\""'
-
-  These are examples only, the Lisp command and the path to the SWANK server
-  may need to be changed in the command depending on the actual configuration.
-
-  It is also possible to run the SWANK server manually prior running Vim.
-  Slimv detects if a SWANK server is running and connects to it at the first
-  evaluation request.
-
-  Note: It is recommended to pass
-    :dont-close t
-  for the swank:create-server function call in the SWANK startup procedure.
-  This makes a permanent SWANK server that listens continuously. Otherwise
-  each time the SWANK connection is lost, the SWANK server needs to be
-  restarted again.
-  Some SWANK features (like Xref) require the load of the contributed modules,
-  so it is recommended to pass
-    :load-contribs t
-  for the swank-loader:init function call in the SWANK strartup procedure.
-  Example startup script:
-
-(load (merge-pathnames "swank-loader.lisp" *load-truename*))
-
-(swank-loader:init :delete nil
-                   :reload nil
-                   :load-contribs t)
-
-(swank:create-server :port 4005
-                     :coding-system "iso-latin-1-unix"
-                     :dont-close t)
-
-
-                                                                 *g:swank_host*
-  Host name or IP address of the SWANK server. Default value is 'localhost'.
-  The SWANK server may run on a remote machine, but currently only unencryplted
-  plain socket communication is supported, no SSH or whatsoever.
-  Please note that if the SWANK server is on a remote machine then Slimv is
-  unable to start it, so you need to run the SWANK server manually.
-
-                                                                 *g:swank_port*
-  The SWANK server is connected to port 4005 by default. This can be changed
-  using the g:swank_port option.
-
-                                                              *g:slimv_balloon*
-  Specifies if tooltips are on (see |swank-describe|).
-
-                                                         *g:slimv_simple_compl*
-  If set to 1, swank:simple-completion is used. By default the fuzzy completion
-  is active, so that "m-v-b<TAB>" expands to "multiple-value-bind" (see
-  |swank-completions|).
-
-                                                              *g:slimv_timeout*
-  There is a 20 second timeout defined for starting up or connecting to the
-  SWANK server. This timeout can be changed via the g:slimv_timeout option.
-  Please note that the very first startup of the SWANK server may take more
-  time than the subsequent startups, so it is not recommended to make this
-  timeout too low.
-
-
-===============================================================================
-FEATURES                                                       *swank-features*
-
-The following major SLIME (SWANK) features are implemented in Slimv.
-For a complete reference of SWANK functions implemented see |swank-functions|.
-
-|swank-eval|                 Evaluation
-|swank-interrupt|            Interrupt Lisp process
-|swank-restarts|             SLDB: Invoke restarts
-|swank-backtrace|            SLDB: Display backtrace with locals
-|swank-arglist|              Function argument list in status line
-|swank-describe|             Describe symbol in tooltip
-|swank-completions|          List of possible symbol completions
-|swank-inspect|              Inspector
-|swank-trace|                Trace function
-|swank-profile|              Profiler
-|swank-xref|                 Cross Reference
-|swank-quickfix|             Compiler errors in quickfix list
-
--------------------------------------------------------------------------------
-EVALUATION                                                         *swank-eval*
-
-  There are various methods for evaluating an s-expression in the SWANK server.
-  It is possible to eval the current top level form, the current subform, the
-  visually selected area, or the whole buffer. Consult the "Evaluation commands"
-  section in |slimv_keyboard| for the possible functions with their respective
-  keyboard shortcuts.
-
-
-  If debugger is activated and the cursor is placed on a frame line in the
-  Backtrace section, then the Interactive-Eval command evaluates expressions
-  in the scope of the given frame ("eval-in-frame").
-
-
--------------------------------------------------------------------------------
-INTERRUPT LISP PROCESS                                        *swank-interrupt*
-
-  It is possible to interrupt a running Lisp or Clojure process by selecting
-  the Interrupt-Lisp-Process menu item in the REPL or Slimv/Repl submenu,
-  or by pressing the keyboard shortcut <Leader>i.
-  It is also possible to map the Ctrl-C shortcut in normal mode to perform the
-  interrupt, but this may interfere with the "Copy to clipboard" function
-  especially on Windows. Here is how to do it:
-
-    noremap  <silent> <C-C>      :call SlimvInterrupt()<CR> 
-
-  When a Lisp process is interrupted, we are dropped in SLDB (SLime DeBugger)
-  and the list of restarts (see |swank-restarts|) and calling frame stack
-  (see |swank-backtrace|) is displayed.
-  It is possible to inspect variables (see |swank-inspect|) and continue
-  or break program execution by selecting the appropriate restart.
-  It is also possible to change the value of variables or redefine functions
-  before resuming execution.
-
-
--------------------------------------------------------------------------------
-INVOKE RESTARTS                                                *swank-restarts*
-
-  In case of an error or when the Lisp process is interrupted SLDB displays
-  the condition and the list of possible restarts, each line startin with the
-  restart identifier, for example:
-
-DIVISION-BY-ZERO detected
-   [Condition of type DIVISION-BY-ZERO]
-
-Restarts:
-  0: [RETRY] Retry SLIME REPL evaluation request.
-  1: [*ABORT] Return to SLIME's top level.
-  2: [ABORT-BREAK] Reset this thread
-  3: [ABORT] Kill this thread
-
-
-  If you press Enter in normal mode on a restart line then the given restart
-  is invoked.
-  The most frequently used restarts have the following shortcuts defined:
-
-    ,a      Abort
-    ,q      Quit To Toplevel
-    ,n      Continue
-
-
--------------------------------------------------------------------------------
-DISPLAY BACKTRACE                                             *swank-backtrace*
-
-  SLDB displays the backtrace for the calling frames, each line starting with
-  the frame identifier, for example:
-
-Backtrace:
-  0: (CCL::%FIXNUM-TRUNCATE #<Unknown Arguments>)
-  1: (/ 1 0)
-  2: (NIL #<Unknown Arguments>)
-  3: (CCL::CALL-CHECK-REGS / 1 0)
-  4: (CCL::CHEAP-EVAL (/ 1 0))
-  5: (SWANK::EVAL-REGION "(/ 1 0)")
-
-
-  If you press Enter in normal mode on a frame line then frame information
-  with the local variable bindings for that frame are displayed at the bottom
-  of the SLDB printout.
-
-  Some commands have modified behaviour when used on a frame:
-
-    Interactive-Eval         Evaluates expressions in the scope of the frame.
-
-    Inspect                  Inspects objects within the scope of the frame.
-
-
--------------------------------------------------------------------------------
-FUNCTION ARGUMENT LIST                                          *swank-arglist*
-
-  When entering an s-expression in insert mode, each time a space is pressed
-  after a non-whitespace character, then SWANK is requested for the function
-  argument list for the current function. If the function is known by SWANK
-  then the function prototype is displayed in the status line. The arglist is
-  condensed in order to fit the status line, so for functions with many
-  arguments the whole definition may not be visible. In this case use the
-  Describe function for displaying the full function definition.
-
-  Note: the function argument list is not displayed when Slimv is not
-  connected to the SWANK server.
-
-
--------------------------------------------------------------------------------
-DESCRIBE SYMBOL                                                *swank-describe*
-
-  When you hover your mouse over a symbol's name then the symbol description
-  is requested from SWANK and displayed in a tooltip, called balloonexpr in
-  Vim terms. This functionality requires that Vim is compiled with the
-  +balloon_eval feature enabled.
-
-  If you don't have +balloon_eval then it is possible to select the
-  Describe-Symbol menu item from the Slimv/Documentation submenu, or press
-  the <Leader>s keyboard shortcut, which then displays the symbol description
-  in the REPL buffer.
-
-  Note: the symbol description is not displayed when Slimv is not connected
-  to the SWANK server.
-
-
--------------------------------------------------------------------------------
-COMPLETIONS                                                 *swank-completions*
-
-  The Vim omni-completion function requests the possible completions for the
-  symbol currently being entered from the SWANK server. The completion list
-  is displayed in a popup menu.
-  The keyboard shortcut for completion is <Tab>. This brings up the completions
-  popup menu if there are multiple choices. In the popup menu subsequent <Tab>
-  keypresses select the next possible completion.
-
-  Option |g:slimv_simple_compl| determines whether simple or fuzzy completion
-  is used. Default is fuzzy completion.
-
-  Note: completions are not displayed when Slimv is not connected to the
-  SWANK server. In this case the Hyperspec database is used for symbol lookup.
-
-
--------------------------------------------------------------------------------
-INSPECTOR                                                       *swank-inspect*
-
-  The Enter key is remapped in normal mode for traversing the inspector output.
-
-  When pressing Enter on the top line starting with 'Inspecting' then the
-  currently inspected value is reloaded.
-
-  When pressing Enter on a line starting with <nn> (where nn is the action
-  identifier) then nn-th action is called.
-
-  When pressing Enter on a line starting with [nn] (where nn is the part
-  identifier) then nn-th part is inspected.
-
-  When pressing Enter on the last line starting with [<<] then the inspector
-  is popped up one level.
-
-
-  If debugger is activated and the cursor is placed on a frame line in the
-  Backtrace section, then the Inspect command inspects objects in the given
-  frame. It means that it is possible to examine the value of local variables
-  within the scope of the given frame ("inspect-in-frame").
-
-
--------------------------------------------------------------------------------
-TRACE                                                             *swank-trace*
-
-  It is possible to tell the SWANK server to trace or untrace functions.
-  There are some subtle differences in the trace handling with or
-  without SWANK.
-
-  For the trace handling without SWANK please check options
-  |g:slimv_template_trace| and |g:slimv_template_untrace|.
-
-  When using the SWANK server the Trace command toggles tracing for the
-  selected function. In this case there is no Untrace command, but there is
-  an Untrace-All command, which completely switches off tracing.
-  This complies with the SWANK tracing functionality.
-
-
--------------------------------------------------------------------------------
-PROFILER                                                        *swank-profile*
-
-  Slimv supports SLIME's profiler. It is possible to toggle profiling on a
-  function, on a set of functions whose name contains a given substring, or
-  unprofile all functions. You may query the profiler for the list of profiled
-  functions. After the profiling session it is possible to display the profiler
-  report. Upon selecting Reset all counters are cleared, so that a new
-  profiling session may be started.
-
-
--------------------------------------------------------------------------------
-CROSS REFERENCE                                                    *swank-xref*
-
-  SLIME's cross reference functionality can be used to list the functions
-  calling a specific function, the list of functions called from a specific
-  function, and other variable, macro, etc. references.
-  Please note that not all Lisp implementations support the xref functionality.
-
-
--------------------------------------------------------------------------------
-QUICKFIX                                                       *swank-quickfix*
-
-  The compiler error messages are fed into Vim's quickfix list, as well as
-  printed in the REPL buffer. Enter the :cw command to open the quickfix window.
-  Use :cn and :cp to jump to the next and previous error location, use :cr to
-  rewind to the first error.
-  Consult |quickfix| for details on using the quickfix functionality.
-
-
-===============================================================================
-FUNCTIONS                                                     *swank-functions*
-
-This section contains a reference for the Emacs/SLIME/SWANK functions
-currently implemented in the Slimv SWANK client.
-
-  :emacs-interrupt
-  :emacs-pong
-  :emacs-return-string
-  :indentation-update
-  swank:compile-file-for-emacs
-  swank:compile-string-for-emacs
-  swank:connection-info
-  swank:create-repl
-  swank:debug-nth-thread
-  swank:describe-function
-  swank:disassemble-form
-  swank:eval-string-in-frame
-  swank:frame-locals-and-catch-tags
-  swank:frame-source-location
-  swank:fuzzy-completions
-  swank:init-inspector
-  swank:inspect-in-frame
-  swank:inspect-nth-part
-  swank:inspector-call-nth-action
-  swank:inspector-pop
-  swank:invoke-nth-restart-for-emacs
-  swank:kill-nth-thread
-  swank:list-threads
-  swank:listener-eval
-  swank:load-file
-  swank:operator-arglist
-  swank:profile-by-substring
-  swank:profile-report
-  swank:profile-reset
-  swank:profiled-functions
-  swank:set-package
-  swank:simple-completions
-  swank:sldb-abort
-  swank:sldb-continue
-  swank:swank-macroexpand-1
-  swank:swank-macroexpand-all
-  swank:swank-require
-  swank:swank-toggle-trace
-  swank:throw-to-toplevel
-  swank:toggle-profile-fdefinition
-  swank:undefine-function
-  swank:unprofile-all
-  swank:untrace-all
-  swank:xref
-  swank-backend:frame-call
-
-===============================================================================
-vim:tw=80:et:wrap:ft=help:norl:

ftplugin/clojure/slimv-clojure.vim

 " slimv-clojure.vim:
 "               Clojure filetype plugin for Slimv
-" Version:      0.8.6
-" Last Change:  05 Aug 2011
+" Version:      0.9.0
+" Last Change:  20 Sep 2011
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
         let cp = cp . ';' . s:TransformFilename( a:lisps[i] )
         let i = i + 1
     endwhile
-    if g:slimv_swank
-        " Try to find swank-clojure and add it to classpath
-        let swanks = split( globpath( &runtimepath, 'swank-clojure'), '\n' )
-        if len( swanks ) > 0
-            let cp = cp . ';' . s:TransformFilename( swanks[0] )
-        endif
+
+    " Try to find swank-clojure and add it to classpath
+    let swanks = split( globpath( &runtimepath, 'swank-clojure'), '\n' )
+    if len( swanks ) > 0
+        let cp = cp . ';' . s:TransformFilename( swanks[0] )
     endif
     return ['java -cp ' . cp . ' clojure.main', 'clojure']
 endfunction
         return b:SlimvBuildStartCmd( lisps )
     endif
 
-    if g:slimv_swank
-        " Check if Clojure is bundled with Slimv
-        let lisps = split( globpath( &runtimepath, 'swank-clojure/clojure*.jar'), '\n' )
-        if len( lisps ) > 0
-            return b:SlimvBuildStartCmd( lisps )
-        endif
+    " Check if Clojure is bundled with Slimv
+    let lisps = split( globpath( &runtimepath, 'swank-clojure/clojure*.jar'), '\n' )
+    if len( lisps ) > 0
+        return b:SlimvBuildStartCmd( lisps )
     endif
 
     " Try to find Clojure in the PATH
     if a:lisp_version[0:2] >= '1.3'
         call SlimvSend( ["(use '[clojure.repl :only (source apropos dir pst doc find-doc)])",
         \                "(use '[clojure.java.javadoc :only (javadoc)])",
-        \                "(use '[clojure.pprint :only (pp pprint)])"], 0, 0 )
+        \                "(use '[clojure.pprint :only (pp pprint)])"], 0 )
     elseif a:lisp_version[0:2] >= '1.2'
         call SlimvSend( ["(use '[clojure.repl :only (source apropos)])",
         \                "(use '[clojure.java.javadoc :only (javadoc)])",
-        \                "(use '[clojure.pprint :only (pp pprint)])"], 0, 0 )
+        \                "(use '[clojure.pprint :only (pp pprint)])"], 0 )
     endif
 endfunction
 

ftplugin/slimv.py

-#!/usr/bin/env python)
-
-###############################################################################
-#
-# Client/Server code for Slimv
-# slimv.py:     Client/Server code for slimv.vim plugin
-# Version:      0.7.7
-# Last Change:  06 Feb 2011
-# Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
-# License:      This file is placed in the public domain.
-#               No warranty, express or implied.
-#               *** ***   Use At-Your-Own-Risk!   *** ***
-# 
-###############################################################################
-
-import os
-import sys
-import getopt
-import time
-import shlex
-import socket
-import traceback
-from subprocess import Popen, PIPE, STDOUT
-from threading import Thread, BoundedSemaphore
-
-autoconnect = 1             # Start and connect server automatically
-
-HOST        = ''            # Symbolic name meaning the local host
-PORT        = 5151          # Arbitrary non-privileged port
-
-debug_level = 0             # Debug level for diagnostic messages
-terminate   = 0             # Main program termination flag
-
-python_path = 'python'      # Path of the Python interpreter (overridden via command line args)
-lisp_path   = 'clisp.exe'   # Path of the Lisp interpreter (overridden via command line args)
-slimv_path  = 'slimv.py'    # Path of this script (determined later)
-run_cmd     = ''            # Complex server-run command (if given via command line args)
-
-# Check if we're running Windows or Mac OS X, otherwise assume Linux
-# Under Cygwin we run the Windows Python
-mswindows = (sys.platform == 'win32' or sys.platform == 'cygwin')
-darwin = (sys.platform == 'darwin')
-
-def log( s, level ):
-    """Print diagnostic messages according to the actual debug level.
-    """
-    if debug_level >= level:
-        sys.stdout.write( s + "\n" )
-
-def str2stream( str ):
-    """Converts string to stream format. Needed for Python 3.x compatibility.
-    """
-    if sys.version_info[0] < 3:
-        return str
-    else:
-        return bytearray( str, 'utf-8' )
-
-def stream2str( arr ):
-    """Converts stream format to string. Needed for Python 3.x compatibility.
-    """
-    if sys.version_info[0] < 3:
-        return arr
-    else:
-        return arr.decode( 'utf-8' )
-
-
-###############################################################################
-#
-# Client part
-#
-###############################################################################
-
-def start_server():
-    """Spawn server. Does not check if the server is already running.
-    """
-    if run_cmd == '':
-        # Complex run command not given, build it from the information available
-        if mswindows or darwin:
-            cmd = []
-        else:
-            cmd = ['xterm', '-T', 'Slimv', '-e']
-        cmd = cmd + [python_path, slimv_path, '-p', str(PORT), '-l', lisp_path, '-s']
-    else:
-        cmd = shlex.split(run_cmd)
-
-    # Start server
-    #TODO: put in try-block
-    if mswindows:
-        CREATE_NEW_CONSOLE = 16
-        server = Popen( cmd, creationflags=CREATE_NEW_CONSOLE )
-    elif darwin:
-        from ScriptingBridge import SBApplication
-
-        term = SBApplication.applicationWithBundleIdentifier_("com.apple.Terminal")
-        term.doScript_in_(" ".join(cmd) + " ; exit", 0) 
-    else:
-        server = Popen( cmd )
-
-    # Allow subprocess (server) to start
-    time.sleep( 2.0 )
-
-
-def send_line( server, line ):
-    """Send a line to the server:
-       first send line length in 4 bytes, then send the line itself.
-    """
-    l = len(line)
-    lstr = chr(l&255) + chr((l>>8)&255) + chr((l>>16)&255) + chr((l>>24)&255)
-    server.send( str2stream( lstr ) )     # send message length first
-    server.send( str2stream( line ) )     # then the message itself
-
-
-def connect_server( output_filename ):
-    """Try to connect server, if server not found then spawn it.
-       Return socket object on success, None on failure.
-    """
-
-    s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
-    try:
-        s.connect( ( 'localhost', PORT ) )
-    except socket.error:
-        if autoconnect:
-            # We need to try to start the server automatically
-            s.close()
-            start_server()
-
-            # Open socket to the server
-            s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
-            try:
-                s.connect( ( 'localhost', PORT ) )
-                if output_filename != '':
-                    send_line( s, 'SLIMV::OUTPUT::' + output_filename )
-            except socket.error:
-                s.close()
-                s =  None
-        else:   # not autoconnect
-            sys.stdout.write( "Server not found\n" )
-            s = None
-    return s
-
-
-def client_file( input_filename, output_filename ):
-    """Main client routine - input file version:
-       starts server if needed then send text to server.
-       Input is read from input file.
-    """
-    s = connect_server( output_filename )
-    if s is None:
-        return
-
-    try:
-        if input_filename != '':
-            file = open( input_filename, 'rt' )
-        else:
-            file = sys.stdin
-        try:
-            # Send contents of the file to the server
-            lines = ''
-            for line in file:
-                lines = lines + line
-            send_line( s, lines )
-        finally:
-            if input_filename != '':
-                file.close()
-    except:
-        return
-
-    s.close()
-
-
-###############################################################################
-#
-# Server part
-#
-###############################################################################
-
-class repl_buffer:
-    def __init__ ( self, output_pipe ):
-
-        self.output   = output_pipe
-        self.filename = ''
-        self.buffer   = ''
-        self.sema     = BoundedSemaphore()
-                            # Semaphore to synchronize access to the global display queue
-
-    def setfile( self, filename ):
-        """Set output filename. Greet user if this is the first time.
-        """
-        self.sema.acquire()
-        oldname = self.filename
-        self.filename = filename
-        if oldname == '':
-            try:
-                # Delete old file creted at a previous run
-                os.remove( self.filename )
-            except:
-                # OK, at least we tried
-                pass
-            self.write_nolock( '\n;;; Slimv client is connected to REPL on port ' + str(PORT) + '.\n', True )
-            user = None
-            if mswindows:
-                user = os.getenv('USERNAME')
-            else:
-                user = os.getenv('USER')
-            if not user:
-                self.write_nolock( ';;; This could be the start of a beautiful program.\n\n', True )
-            else:
-                self.write_nolock( ';;; ' + user + ', this could be the start of a beautiful program.\n\n', True )
-        self.sema.release()
-
-    def writebegin( self ):
-        """Begin the writing process. The process is protected by a semaphore.
-        """
-        self.sema.acquire()
-
-    def writeend( self ):
-        """Finish the writing process. Release semaphore
-        """
-        self.sema.release()
-
-    def write_nolock( self, text, fileonly=False ):
-        """Write text into the global display queue buffer.
-           The writing process is not protected.
-        """
-        if not fileonly:
-            try:
-                # Write all lines to the display
-                os.write( self.output.fileno(), str2stream( text ) )
-            except:
-                pass
-
-        if self.filename != '':
-            tries = 4
-            while tries > 0:
-                try:
-                    file = open( self.filename, 'at' )
-                    try:
-                        #file.write( text )
-                        if self.buffer != '':
-                            # There is output pending
-                            os.write( file.fileno(), str2stream( self.buffer ) )
-                            self.buffer = ''
-                        os.write( file.fileno(), str2stream( text ) )
-                    finally:
-                        file.close()
-                    tries = 0
-                except IOError:
-                    tries = tries - 1
-                    if tries == 0:
-                        traceback.print_exc()
-                    time.sleep(0.05)
-                except:
-                    tries = tries - 1
-                    time.sleep(0.05)
-        elif len( self.buffer ) < 2000:
-            # No filename supplied, collect output info a buffer until filename is given
-            # We collect only some bytes, then probably no filename will be given at all
-            self.buffer = self.buffer + text
-
-    def write( self, text, fileonly=False ):
-        """Write text into the global display queue buffer.
-           The writing process is protected by a semaphome.
-        """
-        self.writebegin()
-        self.write_nolock( text, fileonly )
-        self.writeend()
-
-
-class socket_listener( Thread ):
-    """Server thread to receive text from the client via socket.
-    """
-
-    def __init__ ( self, inp, buffer, pid ):
-        Thread.__init__( self )
-        self.inp = inp
-        self.buffer = buffer
-        self.pid = pid
-
-    def run( self ):
-        global terminate
-
-        # Open server socket
-        self.s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
-        self.s.bind( (HOST, PORT) )
-
-        while not terminate:
-            # Listen server socket
-            self.s.listen( 1 )
-            conn, addr = self.s.accept()
-
-            while not terminate:
-                l = 0
-                lstr = ''
-                # Read length first, it comes in 4 bytes
-                try:
-                    lstr = stream2str( conn.recv(4) )
-                    if len( lstr ) <= 0:
-                        break
-                except:
-                    traceback.print_exc()
-                    break
-                if terminate:
-                    break
-                l = ord(lstr[0]) + (ord(lstr[1])<<8) + (ord(lstr[2])<<16) + (ord(lstr[3])<<24)
-                if l > 0:
-                    # Valid length received, now wait for the message
-                    try:
-                        # Read the message itself
-                        received = ''
-                        while len( received ) < l:
-                            r = stream2str( conn.recv(l) )
-                            if len( r ) == 0:
-                                break
-                            received = received + r
-                        if len( received ) < l:
-                            break
-                    except:
-                        traceback.print_exc()
-                        break
-
-                    if len(received) >= 7 and received[0:7] == 'SLIMV::':
-                        command = received[7:]
-                        if len(command) >= 9 and command[0:9] == 'INTERRUPT':
-                            try:
-                                if mswindows:
-                                    import win32api
-                                    CTRL_C_EVENT = 0
-                                    win32api.GenerateConsoleCtrlEvent( CTRL_C_EVENT, 0 )
-                                else:
-                                    import signal
-                                    os.kill( self.pid, signal.SIGINT )
-                            except:
-                                # OK, at least we tried
-                                # Go on without interruption
-                                pass
-                        if len(command) >= 8 and command[0:8] == 'OUTPUT::':
-                            output_filename = command[8:].rstrip( '\n' )
-                            self.buffer.setfile( output_filename )
-                    else:
-                        # Fork here: write message to the stdin of REPL
-                        # and also write it to the display (display queue buffer)
-                        self.buffer.writebegin()
-                        self.buffer.write_nolock( received )
-                        os.write( self.inp.fileno(), str2stream( received ) )
-                        self.buffer.writeend()
-
-            conn.close()
-
-
-class output_listener( Thread ):
-    """Server thread to receive REPL output.
-    """
-
-    def __init__ ( self, out, buffer ):
-        Thread.__init__( self )
-        self.out = out
-        self.buffer = buffer
-
-    def run( self ):
-        global terminate
-
-        while not terminate:
-            try:
-                # Read input from the stdout of REPL
-                # and write it to the display (display queue buffer)
-                if mswindows:
-                    c = stream2str( self.out.read( 1 ) )
-                    if ord( c ) == 0x0D:
-                        # Special handling of 0x0D+0x0A on Windows
-                        c2 = stream2str( self.out.read( 1 ) )
-                        if ord( c2 ) == 0x0A:
-                            self.buffer.write( '\n' )
-                        else:
-                            self.buffer.write( c )
-                            self.buffer.write( c2 )
-                    else:
-                        self.buffer.write( c )
-                elif darwin:
-                    c = stream2str( self.out.read( 1 ) )
-                    self.buffer.write( c )
-                else:
-                    c = stream2str( self.out.read( 1 ) )
-                    if ord( c ) != 0x0D:
-                        self.buffer.write( c )
-            except:
-                terminate = 1
-
-
-def server():
-    """Main server routine: starts REPL and helper threads for
-       sending and receiving data to/from REPL.
-    """
-    global terminate
-
-    # First check if server already runs
-    s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
-    try:
-        s.connect( ( 'localhost', PORT ) )
-    except socket.error:
-        # Server not found, our time has come, we'll start a new server in a moment
-        pass
-    else:
-        # Server found, nothing to do here
-        s.close()
-        sys.stdout.write( "Server is already running\n" )
-        return
-
-    # Build Lisp-starter command
-    lisp_exp = lisp_path.replace( '\\', '\\\\' )
-    if not mswindows:
-        # Popen does not work with tilde-prefix on Linux
-        # so we expand them to the home directory
-        user = os.path.expanduser( '~/' )
-        lisp_exp = lisp_exp.replace( ' ~/', ' ' + user )
-    cmd = shlex.split( lisp_exp )
-
-    # Start Lisp
-    repl = Popen( cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT )
-
-    buffer = repl_buffer( sys.stdout )
-
-    # Create and start helper threads
-    sl = socket_listener( repl.stdin, buffer, repl.pid )
-    sl.start()
-    ol = output_listener( repl.stdout, buffer )
-    ol.start()
-
-    # Allow Lisp to start, confuse it with some fancy Slimv messages
-    sys.stdout.write( ";;; Slimv server is started on port " + str(PORT) )
-    sys.stdout.write( "\n;;; Slimv is spawning REPL...\n\n" )
-
-    # SBCL on Linux takes input from *debug-io* when in the debugger
-    # let't tie this to the standard input
-    if not mswindows and not darwin and lisp_path.lower().find( 'sbcl' ) >= 0:
-        text = "(setf *debug-io* (make-two-way-stream *standard-input* *standard-output*))\n"
-        os.write( repl.stdin.fileno(), str2stream( text ) )
-        buffer.write( text, True )
-
-    time.sleep(0.5)             # wait for Lisp to start
-
-    # Main server loop
-    while not terminate:
-        try:
-            # Read input from the console and write it
-            # to the stdin of REPL
-            if sys.version_info[0] < 3:
-                text = raw_input()
-            else:
-                text = input()
-            os.write( repl.stdin.fileno(), str2stream( text + "\n" ) )
-            buffer.write( text + "\n", True )
-        except EOFError:
-            # EOF (Ctrl+Z on Windows, Ctrl+D on Linux) pressed?
-            terminate = 1
-        except KeyboardInterrupt:
-            # Interrupted from keyboard (Ctrl+C)?
-            # We just ignore it here, it will be propagated to the child anyway
-            pass
-
-    # The socket is opened here only for waking up the server thread
-    # in order to recognize the termination message
-    #TODO: exit REPL if this script is about to exit
-    cs = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
-    try:
-        cs.connect( ( 'localhost', PORT ) )
-        cs.send( str2stream( ' ' ) )
-    finally:
-        # We don't care if this above fails, we'll exit anyway
-        cs.close()
-
-    # Send exit command to child process and
-    # wake output listener up at the same time
-    try:
-        repl.stdin.close()
-    except:
-        # We don't care if this above fails, we'll exit anyway
-        pass
-
-    # Be nice
-    sys.stdout.write( 'Thank you for using Slimv.\n' )
-
-    # Wait for the child process to exit
-    time.sleep(1)
-
-
-def escape_path( path ):
-    """Surround path containing spaces with backslash + double quote,
-       so that it can be passed as a command line argument.
-    """
-    if path.find( ' ' ) < 0:
-        return path
-    if path[0:2] == '\\\"':
-        return path
-    elif path[0] == '\"':
-        return '\\' + path + '\\'
-    else:
-        return '\\\"' + path + '\\\"'
-
-
-def usage():
-    """Displays program usage information.
-    """
-    progname = os.path.basename( sys.argv[0] )
-    sys.stdout.write( 'Usage: ' + progname + ' [-d LEVEL] [-s] [-f INFILE]\n\n' )
-    sys.stdout.write( 'Options:\n' )
-    sys.stdout.write( '  -?, -h, --help                show this help message and exit\n' )
-    sys.stdout.write( '  -l PATH, --lisp=PATH          path of Lisp interpreter\n' )
-    sys.stdout.write( '  -r PATH, --run=PATH           full command to run the server\n' )
-    sys.stdout.write( '  -p PORT, --port=PORT          port number to use by the server/client\n' )
-    sys.stdout.write( '  -d LEVEL, --debug=LEVEL       set debug LEVEL (0..3)\n' )
-    sys.stdout.write( '  -s                            start server\n' )
-    sys.stdout.write( '  -f FILENAME, --file=FILENAME  start client and send contents of file\n' )
-    sys.stdout.write( '                                named FILENAME to server\n' )
-
-
-###############################################################################
-#
-# Main program
-#
-###############################################################################
-
-if __name__ == '__main__':
-
-    EXIT, SERVER, CLIENT = list( range( 3 ) )
-    mode = CLIENT
-    slimv_path = sys.argv[0]
-    python_path = sys.executable
-    input_filename = ''
-    output_filename = ''
-
-    # Get command line options
-    try:
-        opts, args = getopt.getopt( sys.argv[1:], '?hsf:o:p:l:r:d:', \
-                                    ['help', 'server', 'file=', 'output=', 'port=', 'lisp=', 'run=', 'debug='] )
-
-        # Process options
-        for o, a in opts:
-            if o in ('-?', '-h', '--help'):
-                usage()
-                mode = EXIT
-                break
-            if o in ('-p', '--port'):
-                try:
-                    PORT = int(a)
-                except:
-                    # If given port number is malformed, then keep default value
-                    pass
-            if o in ('-l', '--lisp'):
-                lisp_path = a
-            if o in ('-r', '--run'):
-                run_cmd = a
-            if o in ('-d', '--debug'):
-                try:
-                    debug_level = int(a)
-                except:
-                    # If given level is malformed, then keep default value
-                    pass
-            if o in ('-s', '--server'):
-                mode = SERVER
-            if o in ('-f', '--file'):
-                input_filename = a
-            if o in ('-o', '--output'):
-                output_filename = a
-
-    except getopt.GetoptError:
-        # print help information and exit:
-        usage()
-
-    if mode == SERVER:
-        # We are started in server mode
-        server()
-
-    if mode == CLIENT:
-        # We are started in client mode
-        if run_cmd != '':
-            # It is possible to pass special argument placeholders to run_cmd
-            run_cmd = run_cmd.replace( '@p', escape_path( python_path ) )
-            run_cmd = run_cmd.replace( '@s', escape_path( slimv_path ) )
-            run_cmd = run_cmd.replace( '@l', escape_path( lisp_path ) )
-            run_cmd = run_cmd.replace( '@@', '@' )
-            log( run_cmd, 1 )
-        client_file( input_filename, output_filename )
-
-# --- END OF FILE ---

ftplugin/slimv.vim

 " slimv.vim:    The Superior Lisp Interaction Mode for VIM
-" Version:      0.8.6
-" Last Change:  25 Aug 2011
+" Version:      0.9.0
+" Last Change:  05 Oct 2011
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
     endif
 endfunction
 
-" Build the command to start the client
-function! SlimvMakeClientCommand()
-    if g:slimv_python == '' || g:slimv_lisp == ''
-        " We don't have enough information to build client command
-        return ''