neovim 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/docs.yml +2 -2
- data/.github/workflows/tests.yml +15 -17
- data/.gitignore +1 -1
- data/CHANGELOG.md +10 -0
- data/Flavorfile.lock +1 -0
- data/README.md +14 -30
- data/lib/neovim/buffer.rb +84 -47
- data/lib/neovim/client.rb +233 -92
- data/lib/neovim/remote_module/dsl.rb +30 -0
- data/lib/neovim/remote_module.rb +42 -0
- data/lib/neovim/tabpage.rb +6 -1
- data/lib/neovim/version.rb +1 -1
- data/lib/neovim/window.rb +31 -21
- data/lib/neovim.rb +13 -5
- data/neovim.gemspec +4 -4
- data/script/ci/download_nvim.sh +5 -18
- data/script/host_wrapper.bat +3 -0
- data/script/host_wrapper.sh +5 -0
- data/script/run_acceptance.rb +3 -3
- data/spec/acceptance/client_info_spec.vim +14 -30
- data/spec/acceptance/remote_module_spec.vim +13 -0
- data/spec/acceptance/runtime/example_remote_module.rb +11 -0
- data/spec/acceptance/runtime/init.vim +6 -1
- data/spec/acceptance/runtime/plugin/example_remote_module.lua +23 -0
- metadata +35 -24
- /data/{VimFlavor → Flavorfile} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5320dac4af30229401acf28acf82589d27523b419a65caaf6a9b32982be13559
|
4
|
+
data.tar.gz: 1de09c53e257cce5c3b82902cd998a8b74601e452e25641e7e5f59fceed9bcaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d4950d5edfd43619d9e2e3c4efccaee9ab9219cad3db41fd9d003262870ad2a98f77f3f76dba60c9fb17272fb0b0ad2982acdb1d9b8a31248e2c9ed494e27ec
|
7
|
+
data.tar.gz: 8cc1963557bd46b91e4050363296b4d5b87bd7f1fcf736ac5bb1b6a324d4ec1c84baf2cc6069290c73108ec948af37a2fb57e78b3ec8c5c7622e13f1b6e31e65
|
data/.github/workflows/docs.yml
CHANGED
@@ -18,13 +18,13 @@ jobs:
|
|
18
18
|
- uses: ruby/setup-ruby@v1
|
19
19
|
with:
|
20
20
|
ruby-version: head
|
21
|
+
- name: Install libfuse
|
22
|
+
run: sudo apt install libfuse2
|
21
23
|
- name: Bundle install
|
22
24
|
run: |
|
23
25
|
bundle config set path vendor/bundle
|
24
26
|
bundle install --jobs 3 --retry 3
|
25
27
|
- name: Install Neovim
|
26
|
-
env:
|
27
|
-
BUILD: latest
|
28
28
|
run: bundle exec rake ci:download_nvim
|
29
29
|
- name: Generate docs
|
30
30
|
env:
|
data/.github/workflows/tests.yml
CHANGED
@@ -12,23 +12,23 @@ jobs:
|
|
12
12
|
fail-fast: false
|
13
13
|
matrix:
|
14
14
|
os: [ubuntu-latest, macos-latest]
|
15
|
-
ruby: [
|
15
|
+
ruby: [ruby, head]
|
16
16
|
runs-on: ${{ matrix.os }}
|
17
17
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
18
18
|
steps:
|
19
|
+
- name: Fix up git URLs
|
20
|
+
run: echo -e '[url "https://github.com/"]\n insteadOf = "git://github.com/"' >> ~/.gitconfig
|
19
21
|
- uses: actions/checkout@v2
|
20
22
|
with:
|
21
23
|
repository: neovim/neovim-ruby
|
22
24
|
- uses: ruby/setup-ruby@v1
|
23
25
|
with:
|
24
26
|
ruby-version: ${{ matrix.ruby }}
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
27
|
+
bundler-cache: true
|
28
|
+
- name: Install libfuse
|
29
|
+
run: sudo apt install libfuse2
|
30
|
+
if: matrix.os == 'ubuntu-latest'
|
29
31
|
- name: Install Neovim
|
30
|
-
env:
|
31
|
-
BUILD: nightly
|
32
32
|
run: bundle exec rake ci:download_nvim
|
33
33
|
- name: Run tests
|
34
34
|
env:
|
@@ -37,28 +37,26 @@ jobs:
|
|
37
37
|
windows:
|
38
38
|
strategy:
|
39
39
|
fail-fast: false
|
40
|
-
matrix:
|
41
|
-
ruby: [2.5, 2.6, 2.7, 3.0]
|
42
40
|
runs-on: windows-latest
|
43
41
|
if: "!contains(github.event.head_commit.message, '[skip ci]')"
|
44
42
|
steps:
|
43
|
+
- name: Fix up git URLs
|
44
|
+
run: |
|
45
|
+
echo '[url "https://github.com/"]' >> ~/.gitconfig
|
46
|
+
echo ' insteadOf = "git://github.com/"' >> ~/.gitconfig
|
45
47
|
- uses: actions/checkout@v2
|
46
48
|
with:
|
47
49
|
repository: neovim/neovim-ruby
|
48
50
|
- uses: ruby/setup-ruby@v1
|
49
51
|
with:
|
50
|
-
ruby-version:
|
51
|
-
|
52
|
-
run: |
|
53
|
-
bundle config set path vendor/bundle
|
54
|
-
bundle install --jobs 3 --retry 3
|
52
|
+
ruby-version: ruby
|
53
|
+
bundler-cache: true
|
55
54
|
- name: Install Neovim
|
56
55
|
uses: crazy-max/ghaction-chocolatey@v1
|
57
56
|
with:
|
58
|
-
# TODO: Install `--pre` once nightly release is fixed:
|
59
|
-
# https://github.com/neovim/neovim/issues/13312
|
60
57
|
args: install neovim -fy --ignore-dependencies --ignore-checksums
|
61
58
|
- name: Run tests
|
62
59
|
env:
|
63
|
-
|
60
|
+
VIM_FLAVOR_HOME: 'D:\'
|
61
|
+
NVIM_EXECUTABLE: 'C:\tools\neovim\nvim-win64\bin\nvim'
|
64
62
|
run: bundle exec rake spec
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# 0.10.0
|
2
|
+
|
3
|
+
- Add `Neovim.start_remote` helper for remote module support
|
4
|
+
(https://github.com/neovim/neovim-ruby/pull/107)
|
5
|
+
|
6
|
+
# 0.9.1
|
7
|
+
|
8
|
+
- Fix bug where `Buffer#[]` with `0` returned the last line of the buffer
|
9
|
+
(https://github.com/neovim/neovim-ruby/issues/97)
|
10
|
+
|
1
11
|
# 0.9.0
|
2
12
|
|
3
13
|
- Add RPC support for `:rubyeval`.
|
data/Flavorfile.lock
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
thinca/vim-themis (c1f4d465ce7dd23735513551b5c4c918d9c1bab1 at master)
|
data/README.md
CHANGED
@@ -27,10 +27,10 @@ gem install neovim
|
|
27
27
|
|
28
28
|
## Usage
|
29
29
|
|
30
|
-
|
30
|
+
Neovim supports the `--listen` option for specifying an address to serve its RPC API. To connect to Neovim over a Unix socket, start it up like this:
|
31
31
|
|
32
32
|
```shell
|
33
|
-
$
|
33
|
+
$ nvim --listen /tmp/nvim.sock
|
34
34
|
```
|
35
35
|
|
36
36
|
You can then connect to that socket path to get a `Neovim::Client`:
|
@@ -42,37 +42,21 @@ client = Neovim.attach_unix("/tmp/nvim.sock")
|
|
42
42
|
|
43
43
|
Refer to the [`Neovim` docs](https://www.rubydoc.info/github/neovim/neovim-ruby/main/Neovim) for other ways to connect to `nvim`, and the [`Neovim::Client` docs](https://www.rubydoc.info/github/neovim/neovim-ruby/main/Neovim/Client) for a summary of the client interface.
|
44
44
|
|
45
|
-
###
|
45
|
+
### Remote Modules
|
46
46
|
|
47
|
-
|
47
|
+
Remote modules allow users to define custom handlers in Ruby. To implement a remote module:
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
# line. This command is executed asynchronously, so the return value is
|
55
|
-
# ignored.
|
56
|
-
plug.command(:SetLine, nargs: 1) do |nvim, str|
|
57
|
-
nvim.current.line = str
|
58
|
-
end
|
59
|
-
|
60
|
-
# Define a function called "Sum" which adds two numbers. This function is
|
61
|
-
# executed synchronously, so the result of the block will be returned to nvim.
|
62
|
-
plug.function(:Sum, nargs: 2, sync: true) do |nvim, x, y|
|
63
|
-
x + y
|
64
|
-
end
|
65
|
-
|
66
|
-
# Define an autocmd for the BufEnter event on Ruby files.
|
67
|
-
plug.autocmd(:BufEnter, pattern: "*.rb") do |nvim|
|
68
|
-
nvim.command("echom 'Ruby file, eh?'")
|
69
|
-
end
|
70
|
-
end
|
71
|
-
```
|
49
|
+
- Define your handlers in a plain Ruby script that imports `neovim`
|
50
|
+
- Spawn the script from lua using `jobstart`
|
51
|
+
- Define commands in lua using `nvim_create_user_command` that route to the job's channel ID
|
52
|
+
|
53
|
+
For usage examples, see:
|
72
54
|
|
73
|
-
|
55
|
+
- [`example_remote_module.rb`](spec/acceptance/runtime/example_remote_module.rb)
|
56
|
+
- [`example_remote_module.lua`](spec/acceptance/runtime/plugin/example_remote_module.lua)
|
57
|
+
- [`remote_module_spec.vim`](spec/acceptance/remote_module_spec.vim)
|
74
58
|
|
75
|
-
|
59
|
+
*Note*: Remote modules are a replacement for the deprecated "remote plugin" architecture. See https://github.com/neovim/neovim/issues/27949 for details.
|
76
60
|
|
77
61
|
### Vim Plugin Support
|
78
62
|
|
@@ -85,7 +69,7 @@ The Neovim gem also acts as a compatibility layer for Ruby plugins written for `
|
|
85
69
|
* CI: <https://github.com/neovim/neovim-ruby/actions>
|
86
70
|
* Documentation:
|
87
71
|
* Latest Gem: <https://rubydoc.info/gems/neovim>
|
88
|
-
* Main: <https://rubydoc.info/github/neovim/neovim-ruby/main
|
72
|
+
* Main: <https://rubydoc.info/github/neovim/neovim-ruby/main>
|
89
73
|
|
90
74
|
## Contributing
|
91
75
|
|
data/lib/neovim/buffer.rb
CHANGED
@@ -4,7 +4,7 @@ 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.
|
7
|
+
# The methods documented here were generated using NVIM v0.10.0
|
8
8
|
class Buffer < RemoteObject
|
9
9
|
attr_reader :lines
|
10
10
|
|
@@ -54,7 +54,7 @@ module Neovim
|
|
54
54
|
# @param index [Integer]
|
55
55
|
# @return [String]
|
56
56
|
def [](index)
|
57
|
-
check_index(index)
|
57
|
+
check_index(index, 1)
|
58
58
|
@lines[index - 1]
|
59
59
|
end
|
60
60
|
|
@@ -64,7 +64,7 @@ module Neovim
|
|
64
64
|
# @param str [String]
|
65
65
|
# @return [String]
|
66
66
|
def []=(index, str)
|
67
|
-
check_index(index)
|
67
|
+
check_index(index, 1)
|
68
68
|
@lines[index - 1] = str
|
69
69
|
end
|
70
70
|
|
@@ -73,13 +73,16 @@ module Neovim
|
|
73
73
|
# @param index [Integer]
|
74
74
|
# @return [void]
|
75
75
|
def delete(index)
|
76
|
-
check_index(index)
|
76
|
+
check_index(index, 1)
|
77
77
|
@lines.delete(index - 1)
|
78
78
|
nil
|
79
79
|
end
|
80
80
|
|
81
81
|
# Append a line after the given line (1-indexed).
|
82
82
|
#
|
83
|
+
# Unlike the other methods, `0` is a valid index argument here, and inserts
|
84
|
+
# into the first line of the buffer.
|
85
|
+
#
|
83
86
|
# To maintain backwards compatibility with +vim+, the cursor is forced back
|
84
87
|
# to its previous position after inserting the line.
|
85
88
|
#
|
@@ -87,7 +90,7 @@ module Neovim
|
|
87
90
|
# @param str [String]
|
88
91
|
# @return [String]
|
89
92
|
def append(index, str)
|
90
|
-
check_index(index)
|
93
|
+
check_index(index, 0)
|
91
94
|
window = @session.request(:nvim_get_current_win)
|
92
95
|
cursor = window.cursor
|
93
96
|
|
@@ -127,8 +130,8 @@ module Neovim
|
|
127
130
|
|
128
131
|
private
|
129
132
|
|
130
|
-
def check_index(index)
|
131
|
-
raise ArgumentError, "Index out of bounds" if index <
|
133
|
+
def check_index(index, min)
|
134
|
+
raise ArgumentError, "Index out of bounds" if index < min
|
132
135
|
end
|
133
136
|
|
134
137
|
public
|
@@ -173,6 +176,15 @@ module Neovim
|
|
173
176
|
@param [Array<String>] replacement
|
174
177
|
@return [void]
|
175
178
|
|
179
|
+
@method get_text(start_row, start_col, end_row, end_col, opts)
|
180
|
+
See +:h nvim_buf_get_text()+
|
181
|
+
@param [Integer] start_row
|
182
|
+
@param [Integer] start_col
|
183
|
+
@param [Integer] end_row
|
184
|
+
@param [Integer] end_col
|
185
|
+
@param [Hash] opts
|
186
|
+
@return [Array<String>]
|
187
|
+
|
176
188
|
@method get_offset(index)
|
177
189
|
See +:h nvim_buf_get_offset()+
|
178
190
|
@param [Integer] index
|
@@ -206,11 +218,6 @@ module Neovim
|
|
206
218
|
@param [String] lhs
|
207
219
|
@return [void]
|
208
220
|
|
209
|
-
@method get_commands(opts)
|
210
|
-
See +:h nvim_buf_get_commands()+
|
211
|
-
@param [Hash] opts
|
212
|
-
@return [Hash]
|
213
|
-
|
214
221
|
@method set_var(name, value)
|
215
222
|
See +:h nvim_buf_set_var()+
|
216
223
|
@param [String] name
|
@@ -222,17 +229,6 @@ module Neovim
|
|
222
229
|
@param [String] name
|
223
230
|
@return [void]
|
224
231
|
|
225
|
-
@method get_option(name)
|
226
|
-
See +:h nvim_buf_get_option()+
|
227
|
-
@param [String] name
|
228
|
-
@return [Object]
|
229
|
-
|
230
|
-
@method set_option(name, value)
|
231
|
-
See +:h nvim_buf_set_option()+
|
232
|
-
@param [String] name
|
233
|
-
@param [Object] value
|
234
|
-
@return [void]
|
235
|
-
|
236
232
|
@method get_name
|
237
233
|
See +:h nvim_buf_get_name()+
|
238
234
|
@return [String]
|
@@ -250,11 +246,76 @@ module Neovim
|
|
250
246
|
See +:h nvim_buf_is_valid()+
|
251
247
|
@return [Boolean]
|
252
248
|
|
249
|
+
@method del_mark(name)
|
250
|
+
See +:h nvim_buf_del_mark()+
|
251
|
+
@param [String] name
|
252
|
+
@return [Boolean]
|
253
|
+
|
254
|
+
@method set_mark(name, line, col, opts)
|
255
|
+
See +:h nvim_buf_set_mark()+
|
256
|
+
@param [String] name
|
257
|
+
@param [Integer] line
|
258
|
+
@param [Integer] col
|
259
|
+
@param [Hash] opts
|
260
|
+
@return [Boolean]
|
261
|
+
|
253
262
|
@method get_mark(name)
|
254
263
|
See +:h nvim_buf_get_mark()+
|
255
264
|
@param [String] name
|
256
265
|
@return [Array<Integer>]
|
257
266
|
|
267
|
+
@method call(fun)
|
268
|
+
See +:h nvim_buf_call()+
|
269
|
+
@param [LuaRef] fun
|
270
|
+
@return [Object]
|
271
|
+
|
272
|
+
@method create_user_command(name, command, opts)
|
273
|
+
See +:h nvim_buf_create_user_command()+
|
274
|
+
@param [String] name
|
275
|
+
@param [Object] command
|
276
|
+
@param [Hash] opts
|
277
|
+
@return [void]
|
278
|
+
|
279
|
+
@method del_user_command(name)
|
280
|
+
See +:h nvim_buf_del_user_command()+
|
281
|
+
@param [String] name
|
282
|
+
@return [void]
|
283
|
+
|
284
|
+
@method get_commands(opts)
|
285
|
+
See +:h nvim_buf_get_commands()+
|
286
|
+
@param [Hash] opts
|
287
|
+
@return [Hash]
|
288
|
+
|
289
|
+
@method get_number
|
290
|
+
See +:h nvim_buf_get_number()+
|
291
|
+
@return [Integer]
|
292
|
+
|
293
|
+
@method clear_highlight(ns_id, line_start, line_end)
|
294
|
+
See +:h nvim_buf_clear_highlight()+
|
295
|
+
@param [Integer] ns_id
|
296
|
+
@param [Integer] line_start
|
297
|
+
@param [Integer] line_end
|
298
|
+
@return [void]
|
299
|
+
|
300
|
+
@method set_virtual_text(src_id, line, chunks, opts)
|
301
|
+
See +:h nvim_buf_set_virtual_text()+
|
302
|
+
@param [Integer] src_id
|
303
|
+
@param [Integer] line
|
304
|
+
@param [Array] chunks
|
305
|
+
@param [Hash] opts
|
306
|
+
@return [Integer]
|
307
|
+
|
308
|
+
@method get_option(name)
|
309
|
+
See +:h nvim_buf_get_option()+
|
310
|
+
@param [String] name
|
311
|
+
@return [Object]
|
312
|
+
|
313
|
+
@method set_option(name, value)
|
314
|
+
See +:h nvim_buf_set_option()+
|
315
|
+
@param [String] name
|
316
|
+
@param [Object] value
|
317
|
+
@return [void]
|
318
|
+
|
258
319
|
@method get_extmark_by_id(ns_id, id, opts)
|
259
320
|
See +:h nvim_buf_get_extmark_by_id()+
|
260
321
|
@param [Integer] ns_id
|
@@ -300,30 +361,6 @@ module Neovim
|
|
300
361
|
@param [Integer] line_end
|
301
362
|
@return [void]
|
302
363
|
|
303
|
-
@method set_virtual_text(src_id, line, chunks, opts)
|
304
|
-
See +:h nvim_buf_set_virtual_text()+
|
305
|
-
@param [Integer] src_id
|
306
|
-
@param [Integer] line
|
307
|
-
@param [Array] chunks
|
308
|
-
@param [Hash] opts
|
309
|
-
@return [Integer]
|
310
|
-
|
311
|
-
@method call(fun)
|
312
|
-
See +:h nvim_buf_call()+
|
313
|
-
@param [LuaRef] fun
|
314
|
-
@return [Object]
|
315
|
-
|
316
|
-
@method get_number
|
317
|
-
See +:h nvim_buf_get_number()+
|
318
|
-
@return [Integer]
|
319
|
-
|
320
|
-
@method clear_highlight(ns_id, line_start, line_end)
|
321
|
-
See +:h nvim_buf_clear_highlight()+
|
322
|
-
@param [Integer] ns_id
|
323
|
-
@param [Integer] line_start
|
324
|
-
@param [Integer] line_end
|
325
|
-
@return [void]
|
326
|
-
|
327
364
|
=end
|
328
365
|
end
|
329
366
|
end
|