[slim-vim] Anyone out there? Resurrection!

Mikael Jansson lists at mikael.jansson.be
Tue Apr 29 02:03:46 CDT 2008


Hi,

After having worked on getting the easier parts of a Lisp IDE up and 
running (boot a Lisp and send code to it), I'm getting interested in 
what can be done to talk to SWANK.

Now, while the current implementation of vim+ecl+async seems rather 
complete, barring the issues w/ thrashing internal Vim state, I'd like 
to approach the problem from a different angle.

For me, what's most important is to be able to use a /small/ part of 
SWANK's possibilities for introspection (changing package, getting a 
list of symbols for completion and function lambda lists), and not 
necessarily being able to code Lisp /in/ Vim (even though it helps when 
trying to communicate with SWANK).

So, I've been looking through some different approaches at asynchronous 
communication with Vim, and the most promising approach here is the 
|clientserver| feature.  It gives you an asynchronous send from the 
client, and a blocking receive on the server, completely within the 
boundaries of an unpatched Vim.

What I had in mind was to make a thin wrapper around SWANK, letting it 
pretend to be a Vim server.  I haven't really investigated it any 
further than by testing some code by Vim user "A. Politz":

----------
" client.vim
"
" $ vim --servername client
" :source client.vim
" :Tool "hello, world"
" :messages

"Get to know each other
call remote_expr("SERVER","1","serverid")

augroup server
   au!
   "Do something with the reply
   au RemoteReply * echom remote_read(g:serverid)
augroup END

"Send messages via SERVER
com! -nargs=* Server :call server2client(g:serverid,<q-args>)
----------

----------
" server.vim
"
" $ vim --servername server
" :source server.vim
" :let data = ReceiveDataBlocking()
" :echo data
" :call Reply("I, the server, received \"".data."\" from the client")

"Get to know each other
call remote_expr("CLIENT","1","clientid")

func! ReceiveDataBlocking()
   "called from your tool, blocks till msg is available
   return remote_read(g:clientid)
endfun

func! Reply(msg)
   "called by the tool to reply
   call server2client(g:clientid,a:msg)
endfun
----------

Is this a path you've already been on?

(Yes, it is very simple, but like I said, I believe having something 
simple is better than not having at at all.)

Regarding my current work, it's just an extension of Larry Clapp's 
VILisp package, and is available at 
http://mikael.jansson.be/hacking/limp, so you see where I'm coming from.


-- Mikael


More information about the slim-vim mailing list