nvim 1.7.0 → 1.8.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.
- checksums.yaml +4 -4
- data/INFO.yaml +1 -1
- data/README.md +52 -8
- data/lib/neovim/client.rb +3 -0
- data/lib/neovim/connection.rb +5 -0
- data/lib/neovim/foreign/supplement.rb +5 -1
- data/lib/neovim/info.rb +2 -2
- data/lib/neovim/ruby_provider.rb +15 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1aa2670517c218f7981b8165338f7e985e2e33dcc704a3313326b3ba7de3fd8
|
4
|
+
data.tar.gz: 5bb1a4e2b677fb4f0727c46d1d4cbbe10a40ee6e77677faba5280cf1826b252c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3df9c57b705347c248c743185efeaf86a59291d16309709d4223dd20295632c1ebb413a92cacf501852877796350d37882930f2a77b04596a6efc72b993a26b
|
7
|
+
data.tar.gz: d781ec641a20ad904f82bad5162007bca0674f28ac3009dc928460de5d6943f03fcd9ea9b79e7e1a8a0016ad9c8465014c87170a495d0f60ac8c69560afd3292
|
data/INFO.yaml
CHANGED
data/README.md
CHANGED
@@ -69,14 +69,11 @@ echo Sum(13,7)
|
|
69
69
|
The `:ruby...` commands and the `rubyeval()` function behave as descibed
|
70
70
|
in `:h ruby`.
|
71
71
|
|
72
|
-
Files mentioned in the global variable `g:ruby_require` will be loaded
|
73
|
-
the first Ruby code will be run.
|
72
|
+
Files mentioned in the global variable `g:ruby_require` will be loaded
|
73
|
+
before the first Ruby code will be run.
|
74
74
|
|
75
|
-
Additionally you can directly execute the buffers contents
|
76
|
-
|
77
|
-
```vim
|
78
|
-
set number
|
79
|
-
```
|
75
|
+
Additionally you can directly execute the buffers contents (here, I did
|
76
|
+
`:set number`):
|
80
77
|
|
81
78
|
```
|
82
79
|
1 class C
|
@@ -203,10 +200,57 @@ the RPC communication.
|
|
203
200
|
:%ruby |
|
204
201
|
```
|
205
202
|
|
206
|
-
Yet,
|
203
|
+
Yet, I suggest not to use `fork` and `exec`, except when
|
207
204
|
you're absolutely sure what you're doing.
|
208
205
|
|
209
206
|
|
207
|
+
#### Exception handling
|
208
|
+
|
209
|
+
If you prefer, you may return an error as a value, too.
|
210
|
+
|
211
|
+
```
|
212
|
+
1 $rescue = true
|
213
|
+
2 z = 0
|
214
|
+
3 q = 1 / z
|
215
|
+
~
|
216
|
+
~
|
217
|
+
:set ft=ruby|1,3ruby |
|
218
|
+
```
|
219
|
+
|
220
|
+
Then:
|
221
|
+
|
222
|
+
```
|
223
|
+
1 $rescue = true
|
224
|
+
2 z = 0
|
225
|
+
3 q = 1 / z
|
226
|
+
4 #=> #<ZeroDivisionError: divided by 0>
|
227
|
+
5 puts "=begin", _.backtrace, "=end"
|
228
|
+
~
|
229
|
+
~
|
230
|
+
:5ruby |
|
231
|
+
```
|
232
|
+
|
233
|
+
Even non-standard errors wil be caught.
|
234
|
+
|
235
|
+
```
|
236
|
+
1 def f ; f ; end
|
237
|
+
2 f
|
238
|
+
~
|
239
|
+
~
|
240
|
+
:1,2ruby |
|
241
|
+
```
|
242
|
+
|
243
|
+
```
|
244
|
+
1 $$
|
245
|
+
2 #=> 49042
|
246
|
+
3 sleep 1000
|
247
|
+
~
|
248
|
+
~
|
249
|
+
:3ruby |
|
250
|
+
```
|
251
|
+
Then say 'kill 49042' somewhere else.
|
252
|
+
|
253
|
+
|
210
254
|
#### Global variables
|
211
255
|
|
212
256
|
The global variable `$vim` will be set to the client.
|
data/lib/neovim/client.rb
CHANGED
data/lib/neovim/connection.rb
CHANGED
@@ -47,6 +47,11 @@ module Neovim
|
|
47
47
|
api_info[ "error_types"].each { |type,info|
|
48
48
|
register_error type, info[ "id"]
|
49
49
|
}
|
50
|
+
if api_info["version"]["api_level"] >= 13 then
|
51
|
+
@client.define_singleton_method :err_writeln do |msg|
|
52
|
+
call_api :echo, [ [ msg], [ $/]], true, err: true
|
53
|
+
end
|
54
|
+
end
|
50
55
|
nil
|
51
56
|
end
|
52
57
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# neovim/foreign/supplement.rb --
|
2
|
+
# neovim/foreign/supplement.rb -- Additional useful Ruby functions
|
3
3
|
#
|
4
4
|
|
5
5
|
# The purpose of this is simply to reduce dependencies.
|
@@ -10,6 +10,9 @@ rescue LoadError
|
|
10
10
|
class NilClass ; def notempty? ; end ; end
|
11
11
|
class String ; def notempty? ; self unless empty? ; end ; end
|
12
12
|
class Array ; def notempty? ; self unless empty? ; end ; end
|
13
|
+
class Array ; def first= val ; self[ 0] = val ; end ; end
|
14
|
+
class Array ; def last= val ; self[-1] = val ;
|
15
|
+
rescue IndexError ; a.push val ; end ; end
|
13
16
|
class NilClass ; def to_bool ; false ; end ; end
|
14
17
|
class FalseClass ; def to_bool ; false ; end ; end
|
15
18
|
class Object ; def to_bool ; true ; end ; end
|
@@ -43,5 +46,6 @@ rescue LoadError
|
|
43
46
|
alias starts_with starts_with?
|
44
47
|
alias ends_with ends_with?
|
45
48
|
end
|
49
|
+
class Dir ; def entries! ; entries - %w(. ..) ; end ; end
|
46
50
|
end
|
47
51
|
|
data/lib/neovim/info.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require "neovim/meta.rb"
|
2
2
|
Neovim::INFO = Neovim::Meta.new "nvim",
|
3
|
-
version: "1.
|
3
|
+
version: "1.8.0",
|
4
4
|
license: "BSD-2-Clause+",
|
5
5
|
authors: ["Bertram Scharpf"],
|
6
6
|
email: "software@bertram-scharpf.de",
|
7
7
|
summary: "Yet another Ruby client for Neovim",
|
8
8
|
description: "A simple Ruby client for Neovim.\nClean code, minimal dependecies, no frills, no wokeness.",
|
9
9
|
homepage: "https://github.com/BertramScharpf/ruby-nvim",
|
10
|
-
commit: "
|
10
|
+
commit: "f393e6b"
|
data/lib/neovim/ruby_provider.rb
CHANGED
@@ -81,9 +81,14 @@ module Neovim
|
|
81
81
|
yield client, *args
|
82
82
|
end
|
83
83
|
end
|
84
|
-
rescue
|
85
|
-
|
86
|
-
|
84
|
+
rescue Exception
|
85
|
+
msg = $!.to_s
|
86
|
+
if msg =~ /\A.*?:(\d+):\s*/ then
|
87
|
+
line, msg = $1, $'
|
88
|
+
else
|
89
|
+
line = $@.first[ /:(\d+):in\b/, 1]
|
90
|
+
end
|
91
|
+
client.err_writeln "Ruby #{$!.class}:#{line}: #{msg}"
|
87
92
|
end
|
88
93
|
end
|
89
94
|
|
@@ -164,7 +169,13 @@ module Neovim
|
|
164
169
|
set_globals client, fst..lst do |lines|
|
165
170
|
client.command "#{lst}"
|
166
171
|
WriteBuf.redirect client do
|
167
|
-
r =
|
172
|
+
r = begin
|
173
|
+
script_binding.eval lines.to_s, "ruby_run"
|
174
|
+
rescue Exception
|
175
|
+
$@.pop until $@.empty? or $@.last.ends_with? ":in `empty_binding'"
|
176
|
+
raise unless $rescue
|
177
|
+
$!
|
178
|
+
end
|
168
179
|
unless no_out or r.nil? then
|
169
180
|
script_binding.local_variable_set :_, r
|
170
181
|
puts "#=> #{r.inspect}"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nvim
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-
|
10
|
+
date: 2025-03-30 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
email: software@bertram-scharpf.de
|
13
13
|
executables:
|
@@ -79,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
|
-
rubygems_version: 3.6.
|
82
|
+
rubygems_version: 3.6.6
|
83
83
|
specification_version: 4
|
84
84
|
summary: Yet another Ruby client for Neovim
|
85
85
|
test_files: []
|