Module: Vimrunner

Defined in:
lib/vimrunner.rb,
lib/vimrunner/path.rb,
lib/vimrunner/rspec.rb,
lib/vimrunner/client.rb,
lib/vimrunner/errors.rb,
lib/vimrunner/server.rb,
lib/vimrunner/command.rb,
lib/vimrunner/testing.rb,
lib/vimrunner/version.rb,
lib/vimrunner/platform.rb

Defined Under Namespace

Modules: Platform, RSpec, Testing Classes: Client, Command, ExecutionError, InvalidCommandError, NoSuitableVimError, Path, Server, TimeoutError

Constant Summary collapse

VERSION =
'0.3.5'

Class Method Summary collapse

Class Method Details

.connect(name) ⇒ Object

Public: Connect to an existing Vim process by name. Returns nil in case of failure.

name - The String name of the Vim server to connect to.

Examples

client = Vimrunner.connect("FOO")
# => #<Vimrunner::Client>

Returns a Client for the named server.



63
64
65
# File 'lib/vimrunner.rb', line 63

def self.connect(name)
  Server.new(:name => name).connect
end

.connect!(name) ⇒ Object

Public: Connect to an existing Vim process by name. Raises an exception in case of failure.

name - The String name of the Vim server to connect to.

Examples

client = Vimrunner.connect("FOO")
# => #<Vimrunner::Client>

Returns a Client for the named server.



78
79
80
# File 'lib/vimrunner.rb', line 78

def self.connect!(name)
  Server.new(:name => name).connect!
end

.start(vim = Platform.vim, &blk) ⇒ Object

Public: Start a Vim process and return a Client through which it can be controlled.

vim - The String path to the Vim you wish to use (default: the most

appropriate Vim for your system).

blk - An optional block which will be passed a Client with which you can

communicate with the Vim process. Upon exiting the block, the Vim
process will be terminated.

Examples

client = Vimrunner.start
# => #<Vimrunner::Client>

Vimrunner.start do |client|
  client.command("version")
end

Returns a Client for the started Server.



25
26
27
# File 'lib/vimrunner.rb', line 25

def self.start(vim = Platform.vim, &blk)
  Server.new(:executable => vim).start(&blk)
end

.start_gvim(&blk) ⇒ Object

Public: Start a Vim process with a GUI and return a Client through which it can be controlled.

vim - The String path to the Vim you wish to use (default: the most

appropriate Vim for your system).

blk - An optional block which will be passed a Client with which you can

communicate with the Vim process. Upon exiting the block, the Vim
process will be terminated.

Examples

client = Vimrunner.start
# => #<Vimrunner::Client>

Vimrunner.start do |client|
  client.command("version")
end

Returns a Client for the started Server.



48
49
50
# File 'lib/vimrunner.rb', line 48

def self.start_gvim(&blk)
  Server.new(:executable => Platform.gvim).start(&blk)
end