nvim 1.10.0 → 1.12
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 +23 -2
- data/lib/neovim/client.rb +13 -7
- data/lib/neovim/foreign/supplement/socket.rb +19 -4
- data/lib/neovim/info.rb +2 -2
- data/lib/neovim/ruby_provider.rb +2 -4
- data/lib/neovim/tools/calculator.rb +6 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c052fb6e9b32c5b7d72efcb523ecf47bb6891601e5b9449af145dd721e3f2b7
|
4
|
+
data.tar.gz: 49542a93fe4a187db4017b71e1ba035e4656f5a0a1770287093807ce23b1dbed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f23fa9ffa562a5f6bb89230c6503d29b9fab7a4c59be66063f0136907618585c3b5dd6a6dadab4f65f1044117e07e4bec17706029367e7a82d930746316efd3f
|
7
|
+
data.tar.gz: feea95a8822ad8d363e3d4110a9bc4e141ac899b31399613b13c382ebbd7d8a1572c516e3154ee791743a210238f7ab886a011fcbc7ca8dc039ce6e0ebf461d3
|
data/INFO.yaml
CHANGED
data/README.md
CHANGED
@@ -147,8 +147,7 @@ To inhibit the output of the last value, set the
|
|
147
147
|
|
148
148
|
#### Last return value
|
149
149
|
|
150
|
-
The anonymous variable `_` will hold the result
|
151
|
-
of the last evaluation.
|
150
|
+
The anonymous variable `_` will hold the last non-`nil` result.
|
152
151
|
|
153
152
|
```
|
154
153
|
1 7*11*13
|
@@ -285,6 +284,28 @@ The legacy variables `$curbuf` and `$curwin` are supported.
|
|
285
284
|
```
|
286
285
|
|
287
286
|
|
287
|
+
### Visit and changes lines by :rubydo
|
288
|
+
|
289
|
+
The `$_` and `$.` variables contain the line itself and the line number.
|
290
|
+
`$_` may be changed or assigned to.
|
291
|
+
|
292
|
+
```
|
293
|
+
:rubydo $_.strip! # unindent all
|
294
|
+
:rubydo $_.insert 0, "%4d " % $. # number lines
|
295
|
+
:rubydo i = i.to_i.succ ; $_ = "%4d %s" % [ i, $_] # dto.
|
296
|
+
```
|
297
|
+
|
298
|
+
If `$_` is `nil`, the line will be deleted. If it is an `Enumerable`,
|
299
|
+
each element will be inserted as its own line. All other non-string
|
300
|
+
values will be converted by `#to_s`.
|
301
|
+
|
302
|
+
```
|
303
|
+
:rubydo $_ = nil if $_ =~ /^#/ # delete comment lines
|
304
|
+
:rubydo $_ = $_.split # put each word on its own line
|
305
|
+
:rubydo $_ = [$_]*3 if ~/knock/i # triple lines containing /knock/
|
306
|
+
```
|
307
|
+
|
308
|
+
|
288
309
|
### Requiring Ruby files
|
289
310
|
|
290
311
|
In addition to the `:rubyfile` command as documented, that command can also be
|
data/lib/neovim/client.rb
CHANGED
@@ -162,13 +162,9 @@ module Neovim
|
|
162
162
|
each do |l|
|
163
163
|
h = l.hash
|
164
164
|
m = yield l, @i
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
when Enumerable then m.map { |l| l.to_s }
|
169
|
-
when nil, false then []
|
170
|
-
end
|
171
|
-
if r then
|
165
|
+
if not String === m or m.hash != h then
|
166
|
+
r = result_strings m
|
167
|
+
r.flatten!
|
172
168
|
r.each { |l| l.chomp! }
|
173
169
|
@client.buf_set_lines @buffer, @i-1, @i, true, r
|
174
170
|
@inc = r.length
|
@@ -177,6 +173,16 @@ module Neovim
|
|
177
173
|
end
|
178
174
|
end
|
179
175
|
|
176
|
+
private
|
177
|
+
|
178
|
+
def result_strings obj
|
179
|
+
case obj
|
180
|
+
when Enumerable then obj.map { |l| result_strings l }
|
181
|
+
when nil then []
|
182
|
+
else obj.to_s.lines
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
180
186
|
end
|
181
187
|
|
182
188
|
end
|
@@ -8,13 +8,28 @@ begin
|
|
8
8
|
require "supplement/socket"
|
9
9
|
rescue LoadError
|
10
10
|
require "socket"
|
11
|
+
class BasicSocket
|
12
|
+
private def with_close socket
|
13
|
+
if block_given? then
|
14
|
+
begin
|
15
|
+
yield socket
|
16
|
+
ensure
|
17
|
+
socket.close
|
18
|
+
end
|
19
|
+
else
|
20
|
+
socket
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
11
24
|
class TCPServer
|
12
25
|
alias accept_orig accept
|
13
26
|
private :accept_orig
|
14
|
-
def accept
|
15
|
-
|
16
|
-
|
17
|
-
|
27
|
+
def accept &block ; with_close accept_orig, &block ; end
|
28
|
+
end
|
29
|
+
class UNIXServer
|
30
|
+
alias accept_orig accept
|
31
|
+
private :accept_orig
|
32
|
+
def accept &block ; with_close accept_orig, &block ; end
|
18
33
|
end
|
19
34
|
end
|
20
35
|
|
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.12",
|
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: "b12ec0b"
|
data/lib/neovim/ruby_provider.rb
CHANGED
@@ -158,10 +158,8 @@ module Neovim
|
|
158
158
|
raise unless $rescue and $result != false
|
159
159
|
$!
|
160
160
|
end
|
161
|
-
|
162
|
-
|
163
|
-
puts "#=> #{r.inspect}"
|
164
|
-
end
|
161
|
+
script_binding.local_variable_set :_, r unless r.nil?
|
162
|
+
puts "#=> #{r.inspect}" if $result or ($result.nil? and not r.nil?)
|
165
163
|
end
|
166
164
|
end
|
167
165
|
elsif code == "+" then
|
@@ -12,7 +12,7 @@ module Neovim
|
|
12
12
|
|
13
13
|
def result
|
14
14
|
@result or return
|
15
|
-
r =
|
15
|
+
r = round @result
|
16
16
|
case r
|
17
17
|
when BigDecimal then
|
18
18
|
r = r.to_s "F"
|
@@ -100,7 +100,7 @@ module Neovim
|
|
100
100
|
def parse_number n
|
101
101
|
n.strip!
|
102
102
|
if n =~ %r/ *%\z/ then
|
103
|
-
@prev * (BigDecimal $`) / 100
|
103
|
+
round @prev * (BigDecimal $`) / 100
|
104
104
|
else
|
105
105
|
comma! if not @sep and n =~ /\d,(?:-|\d+\b(?:[^.]|$))/
|
106
106
|
if @sep == "," then n.gsub! ".", "_" ; n.sub! @sep, "."
|
@@ -117,6 +117,10 @@ module Neovim
|
|
117
117
|
end
|
118
118
|
end
|
119
119
|
|
120
|
+
def round x
|
121
|
+
@decs ? (x.round @decs) : x
|
122
|
+
end
|
123
|
+
|
120
124
|
end
|
121
125
|
|
122
126
|
end
|
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.12'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bertram Scharpf
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies: []
|
12
12
|
email: software@bertram-scharpf.de
|
13
13
|
executables:
|
@@ -18,7 +18,6 @@ extra_rdoc_files:
|
|
18
18
|
- LICENSE
|
19
19
|
- README.md
|
20
20
|
- Rakefile
|
21
|
-
- nvim.gemspec
|
22
21
|
- examples/demo.rb
|
23
22
|
- examples/demo_attach
|
24
23
|
- examples/demo_intar
|
@@ -27,6 +26,7 @@ extra_rdoc_files:
|
|
27
26
|
- examples/demo_sub
|
28
27
|
- examples/dump_api
|
29
28
|
- examples/passwords
|
29
|
+
- nvim.gemspec
|
30
30
|
files:
|
31
31
|
- INFO.yaml
|
32
32
|
- LICENSE
|
@@ -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.9
|
83
83
|
specification_version: 4
|
84
84
|
summary: Yet another Ruby client for Neovim
|
85
85
|
test_files: []
|