Class: Neovim::Client
- Inherits:
-
Object
- Object
- Neovim::Client
- Defined in:
- lib/neovim/client.rb
Overview
Client to a running nvim instance. The interface is generated at runtime via the nvim_get_api_info RPC call. Some methods return RemoteObject subclasses (i.e. Buffer, Window, or Tabpage), which similarly have dynamically generated interfaces.
The methods documented here were generated using NVIM v0.2.2
Instance Attribute Summary collapse
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Class Method Summary collapse
Instance Method Summary collapse
-
#call_atomic ⇒ Array
See :h nvim_call_atomic().
-
#call_function(args) ⇒ Object
See :h nvim_call_function().
-
#command ⇒ void
See :h nvim_command().
-
#command_output ⇒ String
See :h nvim_command_output().
-
#current ⇒ Current
Access to objects belonging to the current
nvimcontext. -
#del_current_line ⇒ void
See :h nvim_del_current_line().
-
#del_var ⇒ void
See :h nvim_del_var().
-
#err_write ⇒ void
See :h nvim_err_write().
-
#err_writeln ⇒ void
See :h nvim_err_writeln().
-
#eval ⇒ Object
See :h nvim_eval().
-
#evaluate(expr) ⇒ Object
Evaluate the VimL expression (alias for
nvim_eval). -
#execute_lua(args) ⇒ Object
See :h nvim_execute_lua().
-
#feedkeys(mode, escape_csi) ⇒ void
See :h nvim_feedkeys().
-
#get_api_info ⇒ Array
See :h nvim_get_api_info().
-
#get_color_by_name ⇒ Integer
See :h nvim_get_color_by_name().
-
#get_color_map ⇒ Hash
See :h nvim_get_color_map().
-
#get_current_buf ⇒ Buffer
See :h nvim_get_current_buf().
-
#get_current_line ⇒ String
See :h nvim_get_current_line().
-
#get_current_tabpage ⇒ Tabpage
See :h nvim_get_current_tabpage().
-
#get_current_win ⇒ Window
See :h nvim_get_current_win().
-
#get_hl_by_id(rgb) ⇒ Hash
See :h nvim_get_hl_by_id().
-
#get_hl_by_name(rgb) ⇒ Hash
See :h nvim_get_hl_by_name().
-
#get_keymap ⇒ Array<Hash>
See :h nvim_get_keymap().
-
#get_mode ⇒ Hash
See :h nvim_get_mode().
-
#get_option ⇒ Object
See :h nvim_get_option().
-
#get_var ⇒ Object
See :h nvim_get_var().
-
#get_vvar ⇒ Object
See :h nvim_get_vvar().
-
#initialize(session, api) ⇒ Client
constructor
A new instance of Client.
-
#input ⇒ Integer
See :h nvim_input().
-
#list_bufs ⇒ Array<Buffer>
See :h nvim_list_bufs().
-
#list_runtime_paths ⇒ Array<String>
See :h nvim_list_runtime_paths().
-
#list_tabpages ⇒ Array<Tabpage>
See :h nvim_list_tabpages().
-
#list_wins ⇒ Array<Window>
See :h nvim_list_wins().
-
#message(string) ⇒ void
Display a message.
-
#method_missing(method_name, *args) ⇒ Object
Intercept method calls and delegate to appropriate RPC methods.
-
#methods(*args) ⇒ Object
Extend
methodsto include RPC methods. -
#out_write ⇒ void
See :h nvim_out_write().
-
#replace_termcodes(from_part, do_lt, special) ⇒ String
See :h nvim_replace_termcodes().
-
#respond_to?(method_name) ⇒ Boolean
Extend
respond_to?to support RPC methods. -
#set_current_buf ⇒ void
See :h nvim_set_current_buf().
-
#set_current_dir ⇒ void
See :h nvim_set_current_dir().
-
#set_current_line ⇒ void
See :h nvim_set_current_line().
-
#set_current_tabpage ⇒ void
See :h nvim_set_current_tabpage().
-
#set_current_win ⇒ void
See :h nvim_set_current_win().
-
#set_option(*args) ⇒ Object
Set an option.
-
#set_var(value) ⇒ void
See :h nvim_set_var().
- #shutdown ⇒ Object
-
#strwidth ⇒ Integer
See :h nvim_strwidth().
-
#subscribe ⇒ void
See :h nvim_subscribe().
-
#ui_attach(height, options) ⇒ void
See :h nvim_ui_attach().
-
#ui_detach ⇒ void
See :h nvim_ui_detach().
-
#ui_set_option(value) ⇒ void
See :h nvim_ui_set_option().
-
#ui_try_resize(height) ⇒ void
See :h nvim_ui_try_resize().
-
#unsubscribe ⇒ void
See :h nvim_unsubscribe().
Constructor Details
#initialize(session, api) ⇒ Client
Returns a new instance of Client.
26 27 28 29 |
# File 'lib/neovim/client.rb', line 26 def initialize(session, api) @session = session @api = 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.
32 33 34 35 36 37 38 |
# File 'lib/neovim/client.rb', line 32 def method_missing(method_name, *args) if func = @api.function_for_object_method(self, method_name) func.call(@session, *args) else super end end |
Instance Attribute Details
#api ⇒ Object (readonly)
Returns the value of attribute api.
17 18 19 |
# File 'lib/neovim/client.rb', line 17 def api @api end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
17 18 19 |
# File 'lib/neovim/client.rb', line 17 def session @session end |
Class Method Details
.from_event_loop(event_loop, session = Session.new(event_loop)) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/neovim/client.rb', line 19 def self.from_event_loop(event_loop, session=Session.new(event_loop)) api = API.new(session.request(:nvim_get_api_info)) event_loop.register_types(api, session) new(session, api) end |
Instance Method Details
#call_atomic ⇒ Array
See :h nvim_call_atomic()
|
|
# File 'lib/neovim/client.rb', line 114
|
#call_function(args) ⇒ Object
See :h nvim_call_function()
|
|
# File 'lib/neovim/client.rb', line 114
|
#command ⇒ void
This method returns an undefined value.
See :h nvim_command()
|
|
# File 'lib/neovim/client.rb', line 114
|
#command_output ⇒ String
See :h nvim_command_output()
|
|
# File 'lib/neovim/client.rb', line 114
|
#current ⇒ Current
Access to objects belonging to the current nvim context.
58 59 60 |
# File 'lib/neovim/client.rb', line 58 def current @current ||= Current.new(@session) end |
#del_current_line ⇒ void
This method returns an undefined value.
See :h nvim_del_current_line()
|
|
# File 'lib/neovim/client.rb', line 114
|
#del_var ⇒ void
This method returns an undefined value.
See :h nvim_del_var()
|
|
# File 'lib/neovim/client.rb', line 114
|
#err_write ⇒ void
This method returns an undefined value.
See :h nvim_err_write()
|
|
# File 'lib/neovim/client.rb', line 114
|
#err_writeln ⇒ void
This method returns an undefined value.
See :h nvim_err_writeln()
|
|
# File 'lib/neovim/client.rb', line 114
|
#eval ⇒ Object
See :h nvim_eval()
|
|
# File 'lib/neovim/client.rb', line 114
|
#evaluate(expr) ⇒ Object
Evaluate the VimL expression (alias for nvim_eval).
68 69 70 |
# File 'lib/neovim/client.rb', line 68 def evaluate(expr) @api.function_for_object_method(self, :eval).call(@session, expr) end |
#execute_lua(args) ⇒ Object
See :h nvim_execute_lua()
|
|
# File 'lib/neovim/client.rb', line 114
|
#feedkeys(mode, escape_csi) ⇒ void
This method returns an undefined value.
See :h nvim_feedkeys()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_api_info ⇒ Array
See :h nvim_get_api_info()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_color_by_name ⇒ Integer
See :h nvim_get_color_by_name()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_color_map ⇒ Hash
See :h nvim_get_color_map()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_current_line ⇒ String
See :h nvim_get_current_line()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_current_tabpage ⇒ Tabpage
See :h nvim_get_current_tabpage()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_hl_by_id(rgb) ⇒ Hash
See :h nvim_get_hl_by_id()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_hl_by_name(rgb) ⇒ Hash
See :h nvim_get_hl_by_name()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_keymap ⇒ Array<Hash>
See :h nvim_get_keymap()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_mode ⇒ Hash
See :h nvim_get_mode()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_option ⇒ Object
See :h nvim_get_option()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_var ⇒ Object
See :h nvim_get_var()
|
|
# File 'lib/neovim/client.rb', line 114
|
#get_vvar ⇒ Object
See :h nvim_get_vvar()
|
|
# File 'lib/neovim/client.rb', line 114
|
#input ⇒ Integer
See :h nvim_input()
|
|
# File 'lib/neovim/client.rb', line 114
|
#list_runtime_paths ⇒ Array<String>
See :h nvim_list_runtime_paths()
|
|
# File 'lib/neovim/client.rb', line 114
|
#message(string) ⇒ void
This method returns an undefined value.
Display a message.
76 77 78 |
# File 'lib/neovim/client.rb', line 76 def (string) out_write(string) end |
#methods(*args) ⇒ Object
Extend methods to include RPC methods.
46 47 48 |
# File 'lib/neovim/client.rb', line 46 def methods(*args) super | rpc_methods end |
#out_write ⇒ void
This method returns an undefined value.
See :h nvim_out_write()
|
|
# File 'lib/neovim/client.rb', line 114
|
#replace_termcodes(from_part, do_lt, special) ⇒ String
See :h nvim_replace_termcodes()
|
|
# File 'lib/neovim/client.rb', line 114
|
#respond_to?(method_name) ⇒ Boolean
Extend respond_to? to support RPC methods.
41 42 43 |
# File 'lib/neovim/client.rb', line 41 def respond_to?(method_name, *) super || rpc_methods.include?(method_name.to_sym) end |
#set_current_buf ⇒ void
This method returns an undefined value.
See :h nvim_set_current_buf()
|
|
# File 'lib/neovim/client.rb', line 114
|
#set_current_dir ⇒ void
This method returns an undefined value.
See :h nvim_set_current_dir()
|
|
# File 'lib/neovim/client.rb', line 114
|
#set_current_line ⇒ void
This method returns an undefined value.
See :h nvim_set_current_line()
|
|
# File 'lib/neovim/client.rb', line 114
|
#set_current_tabpage ⇒ void
This method returns an undefined value.
See :h nvim_set_current_tabpage()
|
|
# File 'lib/neovim/client.rb', line 114
|
#set_current_win ⇒ void
This method returns an undefined value.
See :h nvim_set_current_win()
|
|
# File 'lib/neovim/client.rb', line 114
|
#set_option(key, value) ⇒ Object #set_option(optstr) ⇒ Object
Set an option.
92 93 94 95 96 97 98 |
# File 'lib/neovim/client.rb', line 92 def set_option(*args) if args.size > 1 @api.function_for_object_method(self, :set_option).call(@session, *args) else @api.function_for_object_method(self, :command).call(@session, "set #{args.first}") end end |
#set_var(value) ⇒ void
This method returns an undefined value.
See :h nvim_set_var()
|
|
# File 'lib/neovim/client.rb', line 114
|
#shutdown ⇒ Object
100 101 102 |
# File 'lib/neovim/client.rb', line 100 def shutdown @session.shutdown end |
#strwidth ⇒ Integer
See :h nvim_strwidth()
|
|
# File 'lib/neovim/client.rb', line 114
|
#subscribe ⇒ void
This method returns an undefined value.
See :h nvim_subscribe()
|
|
# File 'lib/neovim/client.rb', line 114
|
#ui_attach(height, options) ⇒ void
This method returns an undefined value.
See :h nvim_ui_attach()
|
|
# File 'lib/neovim/client.rb', line 114
|
#ui_detach ⇒ void
This method returns an undefined value.
See :h nvim_ui_detach()
|
|
# File 'lib/neovim/client.rb', line 114
|
#ui_set_option(value) ⇒ void
This method returns an undefined value.
See :h nvim_ui_set_option()
|
|
# File 'lib/neovim/client.rb', line 114
|
#ui_try_resize(height) ⇒ void
This method returns an undefined value.
See :h nvim_ui_try_resize()
|
|
# File 'lib/neovim/client.rb', line 114
|
#unsubscribe ⇒ void
This method returns an undefined value.
See :h nvim_unsubscribe()
|
|
# File 'lib/neovim/client.rb', line 114
|