Class: Neovim::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/neovim/client.rb

Overview

Client to a running nvim instance. The interface is generated at runtime via the vim_get_api_info RPC call. Some methods return RemoteObject subclasses (i.e. Buffer, Window, or Tabpage), which similarly have dynamically generated interfaces.

See Also:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ Client

Returns a new instance of Client.



15
16
17
18
19
20
# File 'lib/neovim/client.rb', line 15

def initialize(session)
  session.discover_api

  @session = session
  @api = session.api
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object

Intercept method calls and delegate to appropriate RPC methods.



23
24
25
26
27
28
29
# File 'lib/neovim/client.rb', line 23

def method_missing(method_name, *args)
  if func = @api.function("vim_#{method_name}")
    func.call(@session, *args)
  else
    super
  end
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



13
14
15
# File 'lib/neovim/client.rb', line 13

def session
  @session
end

Instance Method Details

#call_function(fname, args) ⇒ Object

Parameters:

  • fname (String)
  • args (Array)

Returns:

  • (Object)


# File 'lib/neovim/client.rb', line 65

#change_directory(dir) ⇒ void

This method returns an undefined value.

Parameters:

  • dir (String)


# File 'lib/neovim/client.rb', line 65

#command(str) ⇒ void

This method returns an undefined value.

Parameters:

  • str (String)


# File 'lib/neovim/client.rb', line 65

#command_output(str) ⇒ String

Parameters:

  • str (String)

Returns:

  • (String)


# File 'lib/neovim/client.rb', line 65

#currentCurrent

Access to objects belonging to the current nvim context.

Examples:

Get the current buffer

client.current.buffer

Set the current line

client.current.line = "New line"

Returns:

See Also:



49
50
51
# File 'lib/neovim/client.rb', line 49

def current
  @current ||= Current.new(@session)
end

#del_current_linevoid

This method returns an undefined value.



# File 'lib/neovim/client.rb', line 65

#err_write(str) ⇒ void

This method returns an undefined value.

Parameters:

  • str (String)


# File 'lib/neovim/client.rb', line 65

#eval(str) ⇒ Object

Parameters:

  • str (String)

Returns:

  • (Object)


# File 'lib/neovim/client.rb', line 65

#feedkeys(keys, mode, escape_csi) ⇒ void

This method returns an undefined value.

Parameters:

  • keys (String)
  • mode (String)
  • escape_csi (Boolean)


# File 'lib/neovim/client.rb', line 65

#get_api_infoArray

Returns:

  • (Array)


# File 'lib/neovim/client.rb', line 65

#get_buffersArray<Buffer>

Returns:



# File 'lib/neovim/client.rb', line 65

#get_color_mapDictionary

Returns:

  • (Dictionary)


# File 'lib/neovim/client.rb', line 65

#get_current_bufferBuffer

Returns:



# File 'lib/neovim/client.rb', line 65

#get_current_lineString

Returns:

  • (String)


# File 'lib/neovim/client.rb', line 65

#get_current_tabpageTabpage

Returns:



# File 'lib/neovim/client.rb', line 65

#get_current_windowWindow

Returns:



# File 'lib/neovim/client.rb', line 65

#get_option(name) ⇒ Object

Parameters:

  • name (String)

Returns:

  • (Object)


# File 'lib/neovim/client.rb', line 65

#get_tabpagesArray<Tabpage>

Returns:



# File 'lib/neovim/client.rb', line 65

#get_var(name) ⇒ Object

Parameters:

  • name (String)

Returns:

  • (Object)


# File 'lib/neovim/client.rb', line 65

#get_vvar(name) ⇒ Object

Parameters:

  • name (String)

Returns:

  • (Object)


# File 'lib/neovim/client.rb', line 65

#get_windowsArray<Window>

Returns:



# File 'lib/neovim/client.rb', line 65

#input(keys) ⇒ Fixnum

Parameters:

  • keys (String)

Returns:

  • (Fixnum)


# File 'lib/neovim/client.rb', line 65

#list_runtime_pathsArray<String>

Returns:

  • (Array<String>)


# File 'lib/neovim/client.rb', line 65

#methodsObject

Extend methods to include RPC methods.



37
38
39
# File 'lib/neovim/client.rb', line 37

def methods
  super | rpc_methods
end

#name_to_color(name) ⇒ Fixnum

Parameters:

  • name (String)

Returns:

  • (Fixnum)


# File 'lib/neovim/client.rb', line 65

#out_write(str) ⇒ void

This method returns an undefined value.

Parameters:

  • str (String)


# File 'lib/neovim/client.rb', line 65

#replace_termcodes(str, from_part, do_lt, special) ⇒ String

Parameters:

  • str (String)
  • from_part (Boolean)
  • do_lt (Boolean)
  • special (Boolean)

Returns:

  • (String)


# File 'lib/neovim/client.rb', line 65

#report_error(str) ⇒ void

This method returns an undefined value.

Parameters:

  • str (String)


# File 'lib/neovim/client.rb', line 65

#respond_to?(method_name) ⇒ Boolean

Extend respond_to? to support RPC methods.

Returns:

  • (Boolean)


32
33
34
# File 'lib/neovim/client.rb', line 32

def respond_to?(method_name)
  super || rpc_methods.include?(method_name.to_sym)
end

#set_current_buffer(buffer) ⇒ void

This method returns an undefined value.

Parameters:



# File 'lib/neovim/client.rb', line 65

#set_current_line(line) ⇒ void

This method returns an undefined value.

Parameters:

  • line (String)


# File 'lib/neovim/client.rb', line 65

#set_current_tabpage(tabpage) ⇒ void

This method returns an undefined value.

Parameters:



# File 'lib/neovim/client.rb', line 65

#set_current_window(window) ⇒ void

This method returns an undefined value.

Parameters:



# File 'lib/neovim/client.rb', line 65

#set_option(name, value) ⇒ void

This method returns an undefined value.

Parameters:

  • name (String)
  • value (Object)


# File 'lib/neovim/client.rb', line 65

#set_var(name, value) ⇒ Object

Parameters:

  • name (String)
  • value (Object)

Returns:

  • (Object)


# File 'lib/neovim/client.rb', line 65

#strwidth(str) ⇒ Fixnum

Parameters:

  • str (String)

Returns:

  • (Fixnum)


# File 'lib/neovim/client.rb', line 65

#subscribe(event) ⇒ void

This method returns an undefined value.

Parameters:

  • event (String)


# File 'lib/neovim/client.rb', line 65

#unsubscribe(event) ⇒ void

This method returns an undefined value.

Parameters:

  • event (String)


# File 'lib/neovim/client.rb', line 65