GitXplorerGitXplorer
m

vimbot

public
33 stars
2 forks
0 issues

Commits

List of commits on branch master.
Unverified
489cb3283a89d3e7891d9d9765188179c764317b

Get working with latest bundler

mmaxbrunsfeld committed 10 years ago
Unverified
ed437fbddd355ee15e76aa4ee9c6a81df13482eb

Use ruby syntax in readme

mmaxbrunsfeld committed 12 years ago
Unverified
1b28ab799e766d7ebe64a19d7c14209350991460

Update readme

mmaxbrunsfeld committed 12 years ago
Unverified
cc63ab4b764ca4ac049f4a3c0c68a3d9b78b70d7

Turn off vi compatibility by default

mmaxbrunsfeld committed 13 years ago
Unverified
3e7f9956d93140d7645cc6e272dfe7690f90f83a

Clean up server code

mmaxbrunsfeld committed 13 years ago
Unverified
18447ea5385cfe87e289aca5d88ea6a84313d25c

Refactor Driver methods for escaping command-mode input

mmaxbrunsfeld committed 13 years ago

README

The README file for this repository.

Vimbot - test drive vim from ruby

Usage

Start up a vim application like this:

vim = Vimbot::Driver.new
vim.start

When you want to quit vim,

> vim.stop

By default, Vimbot will try to guess what vim application to use, and use an empty .vimrc and .gvimrc. If you want to specify a vim binary or some config files, you can do this:

> vim = Vimbot::Driver.new(
  :vim => "bin/my_vim",
  :vimrc => "~/.vimrc",
  :gvimrc => ".alternative_gvimrc"
)

From there, you can begin editing:

> vim.type "i", "Hey vim users,"
> vim.append "<CR><CR>", "Try testing your vim plugins with vimbot!"
> vim.command "%s/vim/best_editor_ever/g"

=> "2 substitutions on 2 lines"

API

editing

  • type - sends keyboard input to vim, applying mappings and creating an undo entry where needed
  • normal - like, type, but enters normal mode first
  • insert - like, type, but enters insert mode first
  • append - like, type, but enters insert mode first
  • undo
  • redo
  • clear_buffer
  • raw_type - like type, but does not do vimbot's normal behavior of ensuring that an undo entry is created and that mappings are applied

querying the state of the editor

  • line - get the text of the line the cursor is on
  • line_number, column_number - get the position of the cursor
  • register - get the contents of a given register
  • mode - returns the mode as a letter: i, n, c, v, V, s
  • evaluate - get value of arbitrary vimscript expression
  • in_insert_mode?
  • in_normal_mode?
  • in_command_mode?
  • in_visual_mode?
  • in_select_mode?

configuration

  • source, runtime - load vimscript files
  • set - set a vim option
  • map - add a key mapping

Contributing

New convenience methods are easy to add, and pull requests are welcome!

Dependencies

Vimbot is developed with Vim 7.3 and Ruby 1.9.2.

Author

Vimbot is developed by Max Brunsfeld | @maxbrunsfeld | maxbrunsfeld@gmail.com