Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Control a vim instance through ruby code
Ruby VimL
Tree: 9e1ebfc102

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
spec
vim
.gitignore
.rspec
Gemfile
LICENSE
README.md
Rakefile
_project.vim
vimrunner.gemspec

README.md

Using Vim's client/server functionality, this library exposes a way to spawn a Vim instance and control it programatically. Apart from being a fun party trick, this could be used to do integration testing on vimscript.

The vimrunner executable opens up an irb session with $vim set to a running gvim instance. A few things you can try:

$vim.edit 'some_file_name'  # edit a file
$vim.insert 'Hello, World!' # enter insert mode and write some text
$vim.normal 'T,'            # go back to the nearest comma
$vim.type 'a<cr>'           # append a newline after the comma
$vim.write                  # write file to disk

For more examples of what you can do, you could take a look at the specs, they should be fairly readable.

Note that this should work on a Linux box, but probably won't on a Mac. I'm assuming you'd need to change the binary to mvim at the very least.

This is still fairly experimental, so use with caution. Any issue reports or contributions are very welcome on the github issue tracker

Something went wrong with that request. Please try again.