Tamas Kovacs avatar Tamas Kovacs committed dd2583c

Handle swank message :read-from-minibuffer, this enables [set value] command in the Inspector

Comments (0)

Files changed (3)

-*slimv.txt*                    Slimv                 Last Change: 18 Aug 2012
+*slimv.txt*                    Slimv                 Last Change: 03 Nov 2012
 
 Slimv                                                                  *slimv*
-                               Version 0.9.8
+                               Version 0.9.9
 
 The Superior Lisp Interaction Mode for Vim.
 This plugin is aimed to help Lisp development by interfacing between Vim and
 
   :emacs-interrupt
   :emacs-pong
+  :emacs-return
   :emacs-return-string
   :indentation-update
   swank:compile-file-for-emacs

ftplugin/slimv.vim

 " slimv.vim:    The Superior Lisp Interaction Mode for VIM
 " Version:      0.9.9
-" Last Change:  02 Nov 2012
+" Last Change:  03 Nov 2012
 " Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 " License:      This file is placed in the public domain.
 "               No warranty, express or implied.
     if s:swank_connected
         call SlimvSwankResponse()
     endif
+
+    if exists("s:input_prompt") && s:input_prompt != ''
+        let answer = input( s:input_prompt )
+        unlet s:input_prompt
+        echo ""
+        call SlimvCommand( 'python swank_return("' . answer . '")' )
+    endif
 endfunction
 
 " This function re-triggers the CursorHold event

ftplugin/swank.py

 # SWANK client for Slimv
 # swank.py:     SWANK client code for slimv.vim plugin
 # Version:      0.9.9
-# Last Change:  02 Nov 2012
+# Last Change:  03 Nov 2012
 # Maintainer:   Tamas Kovacs <kovisoft at gmail dot com>
 # License:      This file is placed in the public domain.
 #               No warranty, express or implied.
                     # REPL requests entering a string
                     read_string = r[1:3]
 
+                elif message == ':read-from-minibuffer':
+                    # REPL requests entering a string in the command line
+                    read_string = r[1:3]
+                    vim.command("let s:input_prompt='%s'" % unquote(r[3]).replace("'", "''"))
+
                 elif message == ':indentation-update':
                     for el in r[1]:
                         indent_info[ unquote(el[0]) ] = el[1]
 
 def swank_return_string(s):
     global read_string
-    swank_send('(:emacs-return-string ' + read_string[0] + ' ' + read_string[1] + ' ' + s + ')')
+    swank_send('(:emacs-return-string ' + read_string[0] + ' ' + read_string[1] + ' "' + s + '")')
+    read_string = None
+
+def swank_return(s):
+    global read_string
+    if s != '':
+        swank_send('(:emacs-return ' + read_string[0] + ' ' + read_string[1] + ' "' + s + '")')
     read_string = None
 
 def swank_inspect(symbol):
     form = vim.eval(formvar)
     if read_string:
         # We are in :read-string mode, pass string entered to REPL
-        swank_return_string('"' + form + '"')
+        swank_return_string(form)
     elif form[0] == '[':
         if form[1] == '-':
             swank_inspector_pop()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.