On Saturday 20 October 2001 04:27 am, HarryO wrote:

> I'm a huge vim fan and being able to script it with ruby would be
> fantastic, but, as usual, it's a little hard to get into these things
> without some good examples.

Well, what do you want to do?

You have access to the windows, to the buffers, and to the contents of the 
buffers. As well, you have access to the Vim variables that affect the 
behavior of the editor.

Beyond this, you can use the standard Vim mapping, etc. to "glue" Ruby to 
keystrokes and events (like starting to edit a buffer, for instance).

And the state of the Ruby interpreter seems to persist, so you can (for 
instance) set globals and expect them to remain set.

You can change settings in the editor from Ruby by using VIM::set_option() or 
VIM::evaluate() (with side effects). And you can run arbitrary editor 
commands with VIM::command().

You can edit text in the buffers as needed.

You can load external Ruby files.

So pretty much anything that you want to do, you can do (as far as I can 
tell). For instance, you could make an interactive development environment by 
tying into the debugger and/or irb via named pipes. Then you could map vi 
keystrokes to commands for the debugger.

-- 
Ned Konz
currently: Stanwood, WA
email:     ned / bike-nomad.com
homepage:  http://bike-nomad.com