Module Neovim
In: lib/neovim/buffer.rb
lib/neovim/host/loader.rb
lib/neovim/session/serializer.rb
lib/neovim/session/request.rb
lib/neovim/session/api.rb
lib/neovim/session/event_loop.rb
lib/neovim/session/rpc.rb
lib/neovim/session/notification.rb
lib/neovim/logging.rb
lib/neovim/remote_object.rb
lib/neovim/version.rb
lib/neovim/executable.rb
lib/neovim/current.rb
lib/neovim/session.rb
lib/neovim/plugin.rb
lib/neovim/ruby_provider.rb
lib/neovim/host.rb
lib/neovim/client.rb
lib/neovim/plugin/dsl.rb
lib/neovim/plugin/handler.rb
lib/neovim/tabpage.rb
lib/neovim/ruby_provider/window_ext.rb
lib/neovim/ruby_provider/buffer_ext.rb
lib/neovim/line_range.rb
lib/neovim/window.rb
lib/neovim.rb

The main entrypoint to the Neovim gem. It allows you to connect to a running nvim instance programmatically or define a remote plugin to be autoloaded by nvim.

You can connect to a running nvim instance by setting or inspecting the NVIM_LISTEN_ADDRESS environment variable and connecting via the appropriate attach_ method. This is currently supported for both UNIX domain sockets and TCP. You can also spawn and connect to an nvim subprocess via +Neovim.attach_child(argv)+.

You can define a remote plugin using the +Neovim.plugin+ DSL, which allows you to register commands, functions, and autocmds. Plugins are autoloaded by nvim from the +rplugin/ruby+ directory in your nvim runtime path.

@example Connect over a TCP socket

  Neovim.attach_tcp("0.0.0.0", 3333) # => Neovim::Client

@example Connect over a UNIX domain socket

  Neovim.attach_unix("/tmp/nvim.sock") # => Neovim::Client

@example Spawn and connect to a child nvim process

  Neovim.attach_child(["nvim", "--embed"]) # => Neovim::Client

@example Define a Ruby plugin

  # ~/.config/nvim/rplugin/ruby/plugin.rb

  Neovim.plugin do |plug|
    # Define a command called "SetLine" which sets the contents of the
    # current line. This command is executed asynchronously, so the return
    # value is ignored.
    plug.command(:SetLine, :nargs => 1) do |nvim, str|
      nvim.current.line = str
    end

    # Define a function called "Sum" which adds two numbers. This function is
    # executed synchronously, so the result of the block will be returned to
    # nvim.
    plug.function(:Sum, :nargs => 2, :sync => true) do |nvim, x, y|
      x + y
    end

    # Define an autocmd for the BufEnter event on Ruby files.
    plug.autocmd(:BufEnter, :pattern => "*.rb") do |nvim|
      nvim.command("echom 'Ruby file, eh?'")
    end
  end

@see Client @see Plugin::DSL

Methods

Classes and Modules

Module Neovim::Logging
Module Neovim::RubyProvider
Class Neovim::Buffer
Class Neovim::Client
Class Neovim::Current
Class Neovim::Executable
Class Neovim::Host
Class Neovim::LineRange
Class Neovim::Plugin
Class Neovim::RemoteObject
Class Neovim::Session
Class Neovim::Tabpage
Class Neovim::Window

Constants

VERSION = Gem::Version.new("0.4.0")

Public Class methods

Spawn and connect to a child nvim process.

@param argv [Array] The arguments to pass to the spawned process @return [Client] @see Session.child

Connect to a running nvim instance over TCP.

@param host [String] The hostname or IP address @param port [Integer] The port @return [Client] @see Session.tcp

Connect to a running nvim instance over a UNIX domain socket.

@param socket_path [String] The socket path @return [Client] @see Session.unix

Return a +Neovim::Executable+ representing the active nvim executable.

@return [Executable] @see Executable

The Neovim global logger.

@return [Logger] @see Logging

Set the Neovim global logger.

@param logger [Logger] The target logger @return [Logger] @see Logging

Placeholder method for exposing the remote plugin DSL. This gets temporarily overwritten in +Host::Loader#load+.

@see Host::Loader#load @see Plugin::DSL

[Validate]