neovim 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.gitmodules +1 -1
  4. data/.rspec +1 -0
  5. data/.travis.yml +1 -1
  6. data/CHANGELOG.md +8 -0
  7. data/README.md +5 -3
  8. data/Rakefile +14 -8
  9. data/lib/neovim/buffer.rb +86 -114
  10. data/lib/neovim/client.rb +105 -103
  11. data/lib/neovim/current.rb +8 -18
  12. data/lib/neovim/executable.rb +2 -2
  13. data/lib/neovim/line_range.rb +48 -59
  14. data/lib/neovim/plugin/dsl.rb +11 -3
  15. data/lib/neovim/remote_object.rb +3 -13
  16. data/lib/neovim/ruby_provider.rb +3 -3
  17. data/lib/neovim/ruby_provider/buffer_ext.rb +3 -3
  18. data/lib/neovim/ruby_provider/vim.rb +2 -2
  19. data/lib/neovim/ruby_provider/window_ext.rb +3 -3
  20. data/lib/neovim/session.rb +4 -4
  21. data/lib/neovim/session/api.rb +50 -22
  22. data/lib/neovim/tabpage.rb +29 -19
  23. data/lib/neovim/version.rb +1 -1
  24. data/lib/neovim/window.rb +60 -40
  25. data/script/dump_api +1 -1
  26. data/script/generate_docs +35 -22
  27. data/spec/helper.rb +3 -1
  28. data/spec/integration/rplugin_autocmd_spec.vim +18 -0
  29. data/spec/integration/rplugin_command_spec.vim +97 -0
  30. data/spec/integration/rplugin_function_spec.vim +26 -0
  31. data/spec/integration/ruby_buffer_spec.rb +151 -0
  32. data/spec/{acceptance → integration}/ruby_spec.vim +2 -22
  33. data/spec/integration/ruby_vim_spec.rb +27 -0
  34. data/spec/integration/ruby_window_spec.rb +56 -0
  35. data/spec/{acceptance → integration}/rubydo_spec.vim +27 -18
  36. data/spec/{acceptance → integration}/rubyfile/call_foo.rb +0 -0
  37. data/spec/{acceptance → integration}/rubyfile/curbuf_ivar_get.rb +0 -0
  38. data/spec/{acceptance → integration}/rubyfile/curbuf_ivar_set.rb +0 -0
  39. data/spec/{acceptance → integration}/rubyfile/define_foo.rb +0 -0
  40. data/spec/{acceptance → integration}/rubyfile/raise_standard_error.rb +0 -0
  41. data/spec/{acceptance → integration}/rubyfile/raise_syntax_error.rb +0 -0
  42. data/spec/{acceptance → integration}/rubyfile/set_pwd_after.rb +0 -0
  43. data/spec/{acceptance → integration}/rubyfile/set_pwd_before.rb +0 -0
  44. data/spec/{acceptance → integration}/rubyfile_spec.vim +12 -30
  45. data/spec/integration/runtime/init.vim +9 -0
  46. data/spec/integration/runtime/rplugin/ruby/autocmds.rb +9 -0
  47. data/spec/integration/runtime/rplugin/ruby/commands.rb +59 -0
  48. data/spec/integration/runtime/rplugin/ruby/functions.rb +17 -0
  49. data/spec/integration_spec.rb +119 -0
  50. data/spec/neovim/buffer_spec.rb +0 -167
  51. data/spec/neovim/client_spec.rb +1 -44
  52. data/spec/neovim/current_spec.rb +0 -8
  53. data/spec/neovim/line_range_spec.rb +92 -97
  54. data/spec/neovim/plugin_spec.rb +14 -2
  55. data/spec/neovim/remote_object_spec.rb +4 -4
  56. data/spec/neovim/ruby_provider/buffer_ext_spec.rb +3 -3
  57. data/spec/neovim/ruby_provider/window_ext_spec.rb +1 -1
  58. data/spec/neovim/session/api_spec.rb +40 -35
  59. data/spec/neovim/session/event_loop_spec.rb +1 -1
  60. data/spec/neovim/session_spec.rb +15 -15
  61. metadata +49 -41
  62. data/script/acceptance_tests +0 -46
  63. data/spec/acceptance/rplugin_spec.vim +0 -19
  64. data/spec/acceptance/rubyfile/curbuf.rb +0 -1
  65. data/spec/acceptance/rubyfile/curwin.rb +0 -1
  66. data/spec/acceptance/rubyfile/vim_constants.rb +0 -2
  67. data/spec/acceptance/runtime/init.vim +0 -1
  68. data/spec/acceptance/runtime/rplugin/ruby/plugin.rb +0 -13
  69. data/spec/documentation_spec.rb +0 -24
  70. data/spec/neovim/window_spec.rb +0 -91
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 421a9bb0ec7f5498ee9f00e98a191abf1972c46e
4
- data.tar.gz: b6bdeee0789c0c59cb1337a36826534c1f6a2bb3
3
+ metadata.gz: '056393636b2bb2d1a11454e495378d30b5b886de'
4
+ data.tar.gz: 32202a000db324574ec4b55bdff4ddb0eb1bc4ef
5
5
  SHA512:
6
- metadata.gz: '079597075fd27fd08cd707bbbb5243579db5bf8fe59ea4fc594fa4eca271864f3bc90e4d318527209c161669c150d214d7abeec4aadafbcb0b20d1359b987f97'
7
- data.tar.gz: ad2c5fc451b6b86825edc84d2780e28b5a3a525a1ebaa191e078fa03893fd77a199e10d1265a6dac92fd53c29353b9abbe36847be420afd19f08a6cbe56c88cf
6
+ metadata.gz: a7379f601e28d71f02f89c8687a38a9516e75def94af5a7c867c764f0538a6b4131adcbe503a80e90e48804e8802e0677f013337d597aaff25c87df2eb7fd7a0
7
+ data.tar.gz: a245f880c4c873421f2d41839ff0ea63e923dd25120bb112838881cd33b9bf4ba649dcc96206a836a83c821acd14d56a6125b8d752bdede2f9986a390e40906c
data/.gitignore CHANGED
@@ -17,5 +17,5 @@ test/tmp
17
17
  test/version_tmp
18
18
  tmp
19
19
  spec/workspace
20
- spec/acceptance/runtime/rplugin.vim
20
+ spec/integration/runtime/rplugin.vim
21
21
  vendor/bundle
@@ -1,3 +1,3 @@
1
1
  [submodule "vendor/vader.vim"]
2
- path = vendor/vader.vim
2
+ path = spec/integration/runtime/vader.vim
3
3
  url = https://github.com/junegunn/vader.vim.git
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --exclude-pattern 'spec/integration/**/*'
@@ -17,4 +17,4 @@ before_install:
17
17
  - eval "$(curl -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64"
18
18
 
19
19
  env: REPORT_COVERAGE=1
20
- script: travis_retry bundle exec rake --trace
20
+ script: bundle exec rake --trace
@@ -1,3 +1,11 @@
1
+ # 0.5.0
2
+ - Breaking API changes:
3
+ - Update generated methods to map to `nvim_` RPC functions, rather than the
4
+ deprecated `vim_` ones
5
+ - Remove `Current#range` API, simplifying `LineRange` interface
6
+ - Regenerate docs to reflect nvim 0.2.0
7
+ - Fix support for `:bang` and `:register` plugin DSL options
8
+
1
9
  # 0.4.0
2
10
  - Add `Neovim.executable` for accessing `nvim` info
3
11
  - Fix bug where `$curwin` and `$curbuf` got out of sync after `Vim.command`
data/README.md CHANGED
@@ -44,10 +44,10 @@ Refer to the [`Neovim` docs](http://www.rubydoc.info/github/alexgenco/neovim-rub
44
44
 
45
45
  ### Plugins
46
46
 
47
- The `neovim-ruby-host` executable can be used to spawn Ruby plugins via the `rpcstart` command. A plugin can be defined like this:
47
+ Plugins are Ruby files loaded from the `$VIMRUNTIME/rplugin/ruby/` directory. Here's an example plugin:
48
48
 
49
49
  ```ruby
50
- # $VIMRUNTIME/rplugin/ruby/my_plugin.rb
50
+ # ~/.config/nvim/rplugin/ruby/example_plugin.rb
51
51
 
52
52
  Neovim.plugin do |plug|
53
53
  # Define a command called "SetLine" which sets the contents of the current
@@ -70,7 +70,9 @@ Neovim.plugin do |plug|
70
70
  end
71
71
  ```
72
72
 
73
- Ruby plugins go in the `$VIMRUNTIME/rplugin/ruby` directory, and are auto-loaded after calling `:UpdateRemotePlugins`. Refer to the [`Neovim::Plugin::DSL` docs](http://www.rubydoc.info/github/alexgenco/neovim-ruby/master/Neovim/Plugin/DSL) for a more complete overview.
73
+ When you add or update a plugin, you will need to call `:UpdateRemotePlugins` to update the remote plugin manifest. See `:help remote-plugin-manifest` for more information.
74
+
75
+ Refer to the [`Neovim::Plugin::DSL` docs](http://www.rubydoc.info/github/alexgenco/neovim-ruby/master/Neovim/Plugin/DSL) for a more complete overview of the `Neovim.plugin` DSL.
74
76
 
75
77
  ### Legacy Plugin Support
76
78
 
data/Rakefile CHANGED
@@ -11,16 +11,22 @@ task :api do
11
11
  sh File.expand_path("../script/dump_api", __FILE__)
12
12
  end
13
13
 
14
+ desc "Initialize and update git submodules"
15
+ task :submodules do
16
+ sh "git submodule update --init"
17
+ end
18
+
14
19
  namespace :spec do
15
- desc "Run functional tests"
16
- RSpec::Core::RakeTask.new(:functional)
20
+ desc "Run functional specs"
21
+ RSpec::Core::RakeTask.new(:functional) do |t|
22
+ t.exclude_pattern = "spec/integration_spec.rb,spec/integration/**/*"
23
+ end
17
24
 
18
- desc "Run acceptance tests"
19
- task :acceptance do
20
- sh "git submodule update --init"
21
- sh File.expand_path("../script/acceptance_tests", __FILE__)
25
+ desc "Run integration specs"
26
+ RSpec::Core::RakeTask.new(:integration => :submodules) do |t|
27
+ t.pattern = "spec/integration_spec.rb"
22
28
  end
23
29
  end
24
30
 
25
- task :spec => "spec:functional"
26
- task :default => ["spec:acceptance", "spec:functional"]
31
+ RSpec::Core::RakeTask.new(:spec => :submodules)
32
+ task :default => :spec
@@ -4,14 +4,13 @@ require "neovim/line_range"
4
4
  module Neovim
5
5
  # Class representing an +nvim+ buffer.
6
6
  #
7
- # The methods documented here were generated using NVIM v0.1.7
7
+ # The methods documented here were generated using NVIM v0.2.0
8
8
  class Buffer < RemoteObject
9
- # A +LineRange+ object representing the buffer's lines.
10
- #
11
- # @return [LineRange]
12
- # @see LineRange
13
- def lines
14
- @lines ||= LineRange.new(self, 0, -1)
9
+ attr_reader :lines
10
+
11
+ def initialize(*args)
12
+ super
13
+ @lines = LineRange.new(self)
15
14
  end
16
15
 
17
16
  # Replace all the lines of the buffer.
@@ -19,25 +18,7 @@ module Neovim
19
18
  # @param strs [Array<String>] The replacement lines
20
19
  # @return [Array<String>]
21
20
  def lines=(strs)
22
- lines[0..-1] = strs
23
- end
24
-
25
- # A +LineRange+ object representing the buffer's selection range.
26
- #
27
- # @return [LineRange]
28
- # @see LineRange
29
- def range
30
- @range ||= LineRange.new(self, 0, -1)
31
- end
32
-
33
- # Set the buffer's current selection range.
34
- #
35
- # @param _range [Range] The replacement range
36
- # @return [LineRange]
37
- # @see LineRange
38
- def range=(_range)
39
- _end = _range.exclude_end? ? _range.end - 1 : _range.end
40
- @range = LineRange.new(self, _range.begin, _end)
21
+ @lines[0..-1] = strs
41
22
  end
42
23
 
43
24
  # Get the buffer name.
@@ -73,7 +54,8 @@ module Neovim
73
54
  # @param index [Integer]
74
55
  # @return [String]
75
56
  def [](index)
76
- lines[index-1]
57
+ check_index(index)
58
+ @lines[index-1]
77
59
  end
78
60
 
79
61
  # Set the given line (1-indexed).
@@ -82,7 +64,8 @@ module Neovim
82
64
  # @param str [String]
83
65
  # @return [String]
84
66
  def []=(index, str)
85
- lines[index-1] = str
67
+ check_index(index)
68
+ @lines[index-1] = str
86
69
  end
87
70
 
88
71
  # Delete the given line (1-indexed).
@@ -90,7 +73,9 @@ module Neovim
90
73
  # @param index [Integer]
91
74
  # @return [void]
92
75
  def delete(index)
93
- lines.delete(index-1)
76
+ check_index(index)
77
+ @lines.delete(index-1)
78
+ nil
94
79
  end
95
80
 
96
81
  # Append a line after the given line (1-indexed).
@@ -102,15 +87,12 @@ module Neovim
102
87
  # @param str [String]
103
88
  # @return [String]
104
89
  def append(index, str)
105
- window = @session.request(:vim_get_current_window)
90
+ check_index(index)
91
+ window = @session.request(:nvim_get_current_win)
106
92
  cursor = window.cursor
107
93
 
108
- if index < 0
109
- raise ArgumentError, "Index out of bounds"
110
- else
111
- set_lines(index, index, true, [str])
112
- window.set_cursor(cursor)
113
- end
94
+ set_lines(index, index, true, [str])
95
+ window.set_cursor(cursor)
114
96
  str
115
97
  end
116
98
 
@@ -119,7 +101,7 @@ module Neovim
119
101
  # @return [String, nil]
120
102
  def line
121
103
  if active?
122
- @session.request(:vim_get_current_line)
104
+ @session.request(:nvim_get_current_line)
123
105
  end
124
106
  end
125
107
 
@@ -129,7 +111,7 @@ module Neovim
129
111
  # @return [String, nil]
130
112
  def line=(str)
131
113
  if active?
132
- @session.request(:vim_set_current_line, str)
114
+ @session.request(:nvim_set_current_line, str)
133
115
  end
134
116
  end
135
117
 
@@ -138,8 +120,7 @@ module Neovim
138
120
  # @return [Integer, nil]
139
121
  def line_number
140
122
  if active?
141
- window = @session.request(:vim_get_current_window)
142
- @session.request(:window_get_cursor, window)[0]
123
+ @session.request(:nvim_get_current_win).get_cursor[0]
143
124
  end
144
125
  end
145
126
 
@@ -147,120 +128,110 @@ module Neovim
147
128
  #
148
129
  # @return [Boolean]
149
130
  def active?
150
- @session.request(:vim_get_current_buffer) == self
131
+ @session.request(:nvim_get_current_buf) == self
151
132
  end
152
133
 
153
- # The following methods are dynamically generated.
154
- =begin
155
- @method get_line(index)
156
- Send the +buffer_get_line+ RPC to +nvim+
157
- @param [Integer] index
158
- @return [String]
134
+ private
159
135
 
160
- @method set_line(index, line)
161
- Send the +buffer_set_line+ RPC to +nvim+
162
- @param [Integer] index
163
- @param [String] line
164
- @return [void]
136
+ def check_index(index)
137
+ if index < 0
138
+ raise ArgumentError, "Index out of bounds"
139
+ end
140
+ end
165
141
 
166
- @method del_line(index)
167
- Send the +buffer_del_line+ RPC to +nvim+
168
- @param [Integer] index
169
- @return [void]
142
+ public
170
143
 
171
- @method get_line_slice(start, end, include_start, include_end)
172
- Send the +buffer_get_line_slice+ RPC to +nvim+
144
+ # The following methods are dynamically generated.
145
+ =begin
146
+ @method line_count(buffer)
147
+ See +:h nvim_buf_line_count()+
148
+ @param [Buffer] buffer
149
+ @return [Integer]
150
+
151
+ @method get_lines(buffer, start, end, strict_indexing)
152
+ See +:h nvim_buf_get_lines()+
153
+ @param [Buffer] buffer
173
154
  @param [Integer] start
174
155
  @param [Integer] end
175
- @param [Boolean] include_start
176
- @param [Boolean] include_end
156
+ @param [Boolean] strict_indexing
177
157
  @return [Array<String>]
178
158
 
179
- @method set_line_slice(start, end, include_start, include_end, replacement)
180
- Send the +buffer_set_line_slice+ RPC to +nvim+
159
+ @method set_lines(buffer, start, end, strict_indexing, replacement)
160
+ See +:h nvim_buf_set_lines()+
161
+ @param [Buffer] buffer
181
162
  @param [Integer] start
182
163
  @param [Integer] end
183
- @param [Boolean] include_start
184
- @param [Boolean] include_end
164
+ @param [Boolean] strict_indexing
185
165
  @param [Array<String>] replacement
186
166
  @return [void]
187
167
 
188
- @method set_var(name, value)
189
- Send the +buffer_set_var+ RPC to +nvim+
168
+ @method get_var(buffer, name)
169
+ See +:h nvim_buf_get_var()+
170
+ @param [Buffer] buffer
190
171
  @param [String] name
191
- @param [Object] value
192
172
  @return [Object]
193
173
 
194
- @method del_var(name)
195
- Send the +buffer_del_var+ RPC to +nvim+
196
- @param [String] name
197
- @return [Object]
198
-
199
- @method insert(lnum, lines)
200
- Send the +buffer_insert+ RPC to +nvim+
201
- @param [Integer] lnum
202
- @param [Array<String>] lines
203
- @return [void]
204
-
205
- @method line_count
206
- Send the +buffer_line_count+ RPC to +nvim+
174
+ @method get_changedtick(buffer)
175
+ See +:h nvim_buf_get_changedtick()+
176
+ @param [Buffer] buffer
207
177
  @return [Integer]
208
178
 
209
- @method get_lines(start, end, strict_indexing)
210
- Send the +buffer_get_lines+ RPC to +nvim+
211
- @param [Integer] start
212
- @param [Integer] end
213
- @param [Boolean] strict_indexing
214
- @return [Array<String>]
215
-
216
- @method set_lines(start, end, strict_indexing, replacement)
217
- Send the +buffer_set_lines+ RPC to +nvim+
218
- @param [Integer] start
219
- @param [Integer] end
220
- @param [Boolean] strict_indexing
221
- @param [Array<String>] replacement
179
+ @method set_var(buffer, name, value)
180
+ See +:h nvim_buf_set_var()+
181
+ @param [Buffer] buffer
182
+ @param [String] name
183
+ @param [Object] value
222
184
  @return [void]
223
185
 
224
- @method get_var(name)
225
- Send the +buffer_get_var+ RPC to +nvim+
186
+ @method del_var(buffer, name)
187
+ See +:h nvim_buf_del_var()+
188
+ @param [Buffer] buffer
226
189
  @param [String] name
227
- @return [Object]
190
+ @return [void]
228
191
 
229
- @method get_option(name)
230
- Send the +buffer_get_option+ RPC to +nvim+
192
+ @method get_option(buffer, name)
193
+ See +:h nvim_buf_get_option()+
194
+ @param [Buffer] buffer
231
195
  @param [String] name
232
196
  @return [Object]
233
197
 
234
- @method set_option(name, value)
235
- Send the +buffer_set_option+ RPC to +nvim+
198
+ @method set_option(buffer, name, value)
199
+ See +:h nvim_buf_set_option()+
200
+ @param [Buffer] buffer
236
201
  @param [String] name
237
202
  @param [Object] value
238
203
  @return [void]
239
204
 
240
- @method get_number
241
- Send the +buffer_get_number+ RPC to +nvim+
205
+ @method get_number(buffer)
206
+ See +:h nvim_buf_get_number()+
207
+ @param [Buffer] buffer
242
208
  @return [Integer]
243
209
 
244
- @method get_name
245
- Send the +buffer_get_name+ RPC to +nvim+
210
+ @method get_name(buffer)
211
+ See +:h nvim_buf_get_name()+
212
+ @param [Buffer] buffer
246
213
  @return [String]
247
214
 
248
- @method set_name(name)
249
- Send the +buffer_set_name+ RPC to +nvim+
215
+ @method set_name(buffer, name)
216
+ See +:h nvim_buf_set_name()+
217
+ @param [Buffer] buffer
250
218
  @param [String] name
251
219
  @return [void]
252
220
 
253
- @method is_valid
254
- Send the +buffer_is_valid+ RPC to +nvim+
221
+ @method is_valid(buffer)
222
+ See +:h nvim_buf_is_valid()+
223
+ @param [Buffer] buffer
255
224
  @return [Boolean]
256
225
 
257
- @method get_mark(name)
258
- Send the +buffer_get_mark+ RPC to +nvim+
226
+ @method get_mark(buffer, name)
227
+ See +:h nvim_buf_get_mark()+
228
+ @param [Buffer] buffer
259
229
  @param [String] name
260
230
  @return [Array<Integer>]
261
231
 
262
- @method add_highlight(src_id, hl_group, line, col_start, col_end)
263
- Send the +buffer_add_highlight+ RPC to +nvim+
232
+ @method add_highlight(buffer, src_id, hl_group, line, col_start, col_end)
233
+ See +:h nvim_buf_add_highlight()+
234
+ @param [Buffer] buffer
264
235
  @param [Integer] src_id
265
236
  @param [String] hl_group
266
237
  @param [Integer] line
@@ -268,8 +239,9 @@ module Neovim
268
239
  @param [Integer] col_end
269
240
  @return [Integer]
270
241
 
271
- @method clear_highlight(src_id, line_start, line_end)
272
- Send the +buffer_clear_highlight+ RPC to +nvim+
242
+ @method clear_highlight(buffer, src_id, line_start, line_end)
243
+ See +:h nvim_buf_clear_highlight()+
244
+ @param [Buffer] buffer
273
245
  @param [Integer] src_id
274
246
  @param [Integer] line_start
275
247
  @param [Integer] line_end
@@ -2,11 +2,11 @@ require "neovim/current"
2
2
 
3
3
  module Neovim
4
4
  # Client to a running +nvim+ instance. The interface is generated at
5
- # runtime via the +vim_get_api_info+ RPC call. Some methods return
5
+ # runtime via the +nvim_get_api_info+ RPC call. Some methods return
6
6
  # +RemoteObject+ subclasses (i.e. +Buffer+, +Window+, or +Tabpage+),
7
7
  # which similarly have dynamically generated interfaces.
8
8
  #
9
- # The methods documented here were generated using NVIM v0.1.7
9
+ # The methods documented here were generated using NVIM v0.2.0
10
10
  #
11
11
  # @see Buffer
12
12
  # @see Window
@@ -24,7 +24,7 @@ module Neovim
24
24
 
25
25
  # Intercept method calls and delegate to appropriate RPC methods.
26
26
  def method_missing(method_name, *args)
27
- if func = @api.function("vim_#{method_name}")
27
+ if func = @api.function_for_object_method(self, method_name)
28
28
  func.call(@session, *args)
29
29
  else
30
30
  super
@@ -37,7 +37,7 @@ module Neovim
37
37
  end
38
38
 
39
39
  # Extend +methods+ to include RPC methods.
40
- def methods
40
+ def methods(*args)
41
41
  super | rpc_methods
42
42
  end
43
43
 
@@ -53,14 +53,14 @@ module Neovim
53
53
  @current ||= Current.new(@session)
54
54
  end
55
55
 
56
- # Evaluate the VimL expression (alias for +vim_eval+).
56
+ # Evaluate the VimL expression (alias for +nvim_eval+).
57
57
  #
58
58
  # @param expr [String] A VimL expression.
59
59
  # @return [Object]
60
60
  # @example Return a list from VimL
61
61
  # client.evaluate('[1, 2]') # => [1, 2]
62
62
  def evaluate(expr)
63
- @api.function(:vim_eval).call(@session, expr)
63
+ @api.function_for_object_method(self, :eval).call(@session, expr)
64
64
  end
65
65
 
66
66
  # Display a message.
@@ -85,9 +85,9 @@ module Neovim
85
85
  # client.set_option("timeoutlen=0")
86
86
  def set_option(*args)
87
87
  if args.size > 1
88
- @api.function("vim_set_option").call(@session, *args)
88
+ @api.function_for_object_method(self, :set_option).call(@session, *args)
89
89
  else
90
- @api.function("vim_command").call(@session, "set #{args.first}")
90
+ @api.function_for_object_method(self, :command).call(@session, "set #{args.first}")
91
91
  end
92
92
  end
93
93
 
@@ -98,184 +98,186 @@ module Neovim
98
98
  private
99
99
 
100
100
  def rpc_methods
101
- @api.functions_with_prefix("vim_").map do |func|
102
- func.name.sub(/\Avim_/, "").to_sym
103
- end
101
+ @api.functions_for_object(self).map(&:method_name)
104
102
  end
105
103
 
106
104
  public
107
105
 
108
106
  # The following methods are dynamically generated.
109
107
  =begin
110
- @method set_var(name, value)
111
- Send the +vim_set_var+ RPC to +nvim+
112
- @param [String] name
113
- @param [Object] value
114
- @return [Object]
108
+ @method ui_attach(height, options)
109
+ See +:h nvim_ui_attach()+
110
+ @param [Integer] height
111
+ @param [Hash] options
112
+ @return [void]
115
113
 
116
- @method del_var(name)
117
- Send the +vim_del_var+ RPC to +nvim+
118
- @param [String] name
119
- @return [Object]
114
+ @method ui_detach
115
+ See +:h nvim_ui_detach()+
116
+ @return [void]
120
117
 
121
- @method command(command)
122
- Send the +vim_command+ RPC to +nvim+
123
- @param [String] command
118
+ @method ui_try_resize(height)
119
+ See +:h nvim_ui_try_resize()+
120
+ @param [Integer] height
124
121
  @return [void]
125
122
 
126
- @method feedkeys(keys, mode, escape_csi)
127
- Send the +vim_feedkeys+ RPC to +nvim+
128
- @param [String] keys
123
+ @method ui_set_option(value)
124
+ See +:h nvim_ui_set_option()+
125
+ @param [Object] value
126
+ @return [void]
127
+
128
+ @method command
129
+ See +:h nvim_command()+
130
+ @return [void]
131
+
132
+ @method feedkeys(mode, escape_csi)
133
+ See +:h nvim_feedkeys()+
129
134
  @param [String] mode
130
135
  @param [Boolean] escape_csi
131
136
  @return [void]
132
137
 
133
- @method input(keys)
134
- Send the +vim_input+ RPC to +nvim+
135
- @param [String] keys
138
+ @method input
139
+ See +:h nvim_input()+
136
140
  @return [Integer]
137
141
 
138
- @method replace_termcodes(str, from_part, do_lt, special)
139
- Send the +vim_replace_termcodes+ RPC to +nvim+
140
- @param [String] str
142
+ @method replace_termcodes(from_part, do_lt, special)
143
+ See +:h nvim_replace_termcodes()+
141
144
  @param [Boolean] from_part
142
145
  @param [Boolean] do_lt
143
146
  @param [Boolean] special
144
147
  @return [String]
145
148
 
146
- @method command_output(str)
147
- Send the +vim_command_output+ RPC to +nvim+
148
- @param [String] str
149
+ @method command_output
150
+ See +:h nvim_command_output()+
149
151
  @return [String]
150
152
 
151
- @method eval(expr)
152
- Send the +vim_eval+ RPC to +nvim+
153
- @param [String] expr
153
+ @method eval
154
+ See +:h nvim_eval()+
154
155
  @return [Object]
155
156
 
156
- @method call_function(fname, args)
157
- Send the +vim_call_function+ RPC to +nvim+
158
- @param [String] fname
157
+ @method call_function(args)
158
+ See +:h nvim_call_function()+
159
159
  @param [Array] args
160
160
  @return [Object]
161
161
 
162
- @method strwidth(str)
163
- Send the +vim_strwidth+ RPC to +nvim+
164
- @param [String] str
162
+ @method strwidth
163
+ See +:h nvim_strwidth()+
165
164
  @return [Integer]
166
165
 
167
166
  @method list_runtime_paths
168
- Send the +vim_list_runtime_paths+ RPC to +nvim+
167
+ See +:h nvim_list_runtime_paths()+
169
168
  @return [Array<String>]
170
169
 
171
- @method change_directory(dir)
172
- Send the +vim_change_directory+ RPC to +nvim+
173
- @param [String] dir
170
+ @method set_current_dir
171
+ See +:h nvim_set_current_dir()+
174
172
  @return [void]
175
173
 
176
174
  @method get_current_line
177
- Send the +vim_get_current_line+ RPC to +nvim+
175
+ See +:h nvim_get_current_line()+
178
176
  @return [String]
179
177
 
180
- @method set_current_line(line)
181
- Send the +vim_set_current_line+ RPC to +nvim+
182
- @param [String] line
178
+ @method set_current_line
179
+ See +:h nvim_set_current_line()+
183
180
  @return [void]
184
181
 
185
182
  @method del_current_line
186
- Send the +vim_del_current_line+ RPC to +nvim+
183
+ See +:h nvim_del_current_line()+
187
184
  @return [void]
188
185
 
189
- @method get_var(name)
190
- Send the +vim_get_var+ RPC to +nvim+
191
- @param [String] name
186
+ @method get_var
187
+ See +:h nvim_get_var()+
192
188
  @return [Object]
193
189
 
194
- @method get_vvar(name)
195
- Send the +vim_get_vvar+ RPC to +nvim+
196
- @param [String] name
190
+ @method set_var(value)
191
+ See +:h nvim_set_var()+
192
+ @param [Object] value
193
+ @return [void]
194
+
195
+ @method del_var
196
+ See +:h nvim_del_var()+
197
+ @return [void]
198
+
199
+ @method get_vvar
200
+ See +:h nvim_get_vvar()+
197
201
  @return [Object]
198
202
 
199
- @method get_option(name)
200
- Send the +vim_get_option+ RPC to +nvim+
201
- @param [String] name
203
+ @method get_option
204
+ See +:h nvim_get_option()+
202
205
  @return [Object]
203
206
 
204
- @method out_write(str)
205
- Send the +vim_out_write+ RPC to +nvim+
206
- @param [String] str
207
+ @method out_write
208
+ See +:h nvim_out_write()+
207
209
  @return [void]
208
210
 
209
- @method err_write(str)
210
- Send the +vim_err_write+ RPC to +nvim+
211
- @param [String] str
211
+ @method err_write
212
+ See +:h nvim_err_write()+
212
213
  @return [void]
213
214
 
214
- @method report_error(str)
215
- Send the +vim_report_error+ RPC to +nvim+
216
- @param [String] str
215
+ @method err_writeln
216
+ See +:h nvim_err_writeln()+
217
217
  @return [void]
218
218
 
219
- @method get_buffers
220
- Send the +vim_get_buffers+ RPC to +nvim+
219
+ @method list_bufs
220
+ See +:h nvim_list_bufs()+
221
221
  @return [Array<Buffer>]
222
222
 
223
- @method get_current_buffer
224
- Send the +vim_get_current_buffer+ RPC to +nvim+
223
+ @method get_current_buf
224
+ See +:h nvim_get_current_buf()+
225
225
  @return [Buffer]
226
226
 
227
- @method set_current_buffer(buffer)
228
- Send the +vim_set_current_buffer+ RPC to +nvim+
229
- @param [Buffer] buffer
227
+ @method set_current_buf
228
+ See +:h nvim_set_current_buf()+
230
229
  @return [void]
231
230
 
232
- @method get_windows
233
- Send the +vim_get_windows+ RPC to +nvim+
231
+ @method list_wins
232
+ See +:h nvim_list_wins()+
234
233
  @return [Array<Window>]
235
234
 
236
- @method get_current_window
237
- Send the +vim_get_current_window+ RPC to +nvim+
235
+ @method get_current_win
236
+ See +:h nvim_get_current_win()+
238
237
  @return [Window]
239
238
 
240
- @method set_current_window(window)
241
- Send the +vim_set_current_window+ RPC to +nvim+
242
- @param [Window] window
239
+ @method set_current_win
240
+ See +:h nvim_set_current_win()+
243
241
  @return [void]
244
242
 
245
- @method get_tabpages
246
- Send the +vim_get_tabpages+ RPC to +nvim+
243
+ @method list_tabpages
244
+ See +:h nvim_list_tabpages()+
247
245
  @return [Array<Tabpage>]
248
246
 
249
247
  @method get_current_tabpage
250
- Send the +vim_get_current_tabpage+ RPC to +nvim+
248
+ See +:h nvim_get_current_tabpage()+
251
249
  @return [Tabpage]
252
250
 
253
- @method set_current_tabpage(tabpage)
254
- Send the +vim_set_current_tabpage+ RPC to +nvim+
255
- @param [Tabpage] tabpage
251
+ @method set_current_tabpage
252
+ See +:h nvim_set_current_tabpage()+
256
253
  @return [void]
257
254
 
258
- @method subscribe(event)
259
- Send the +vim_subscribe+ RPC to +nvim+
260
- @param [String] event
255
+ @method subscribe
256
+ See +:h nvim_subscribe()+
261
257
  @return [void]
262
258
 
263
- @method unsubscribe(event)
264
- Send the +vim_unsubscribe+ RPC to +nvim+
265
- @param [String] event
259
+ @method unsubscribe
260
+ See +:h nvim_unsubscribe()+
266
261
  @return [void]
267
262
 
268
- @method name_to_color(name)
269
- Send the +vim_name_to_color+ RPC to +nvim+
270
- @param [String] name
263
+ @method get_color_by_name
264
+ See +:h nvim_get_color_by_name()+
271
265
  @return [Integer]
272
266
 
273
267
  @method get_color_map
274
- Send the +vim_get_color_map+ RPC to +nvim+
275
- @return [Dictionary]
268
+ See +:h nvim_get_color_map()+
269
+ @return [Hash]
270
+
271
+ @method get_mode
272
+ See +:h nvim_get_mode()+
273
+ @return [Hash]
276
274
 
277
275
  @method get_api_info
278
- Send the +vim_get_api_info+ RPC to +nvim+
276
+ See +:h nvim_get_api_info()+
277
+ @return [Array]
278
+
279
+ @method call_atomic
280
+ See +:h nvim_call_atomic()+
279
281
  @return [Array]
280
282
 
281
283
  =end