nvim 1.8.0 → 1.9.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1aa2670517c218f7981b8165338f7e985e2e33dcc704a3313326b3ba7de3fd8
4
- data.tar.gz: 5bb1a4e2b677fb4f0727c46d1d4cbbe10a40ee6e77677faba5280cf1826b252c
3
+ metadata.gz: 769e2a668a793cc62f7683c1e6a40bb0ab703a65c1538a82afe6ef08326d023b
4
+ data.tar.gz: aa69006de05ddf6eba0635b6ce35478b8ef074fa3fcd73be300b2d78089436a4
5
5
  SHA512:
6
- metadata.gz: e3df9c57b705347c248c743185efeaf86a59291d16309709d4223dd20295632c1ebb413a92cacf501852877796350d37882930f2a77b04596a6efc72b993a26b
7
- data.tar.gz: d781ec641a20ad904f82bad5162007bca0674f28ac3009dc928460de5d6943f03fcd9ea9b79e7e1a8a0016ad9c8465014c87170a495d0f60ac8c69560afd3292
6
+ metadata.gz: b3ddad1a7f7719f17e17c1767d3bdf394b5703c24fc700840c2b0e39c332c9290225fc94d5b4abc5d391d979e64a796b11b82bca1c44ef77c0ab4ad7cfbae401
7
+ data.tar.gz: 934aff104babc3f80f3265d6f26881cb02b85ad3d8b8cbe53fe3a716e12dc3d5d7c157e1d68a819fc7011fb05f5999562fb08b0bee6bf5cc22c7dbd4268093df
data/INFO.yaml CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
 
5
5
  nvim:
6
- version: 1.8.0
6
+ version: 1.9.0
7
7
  license: BSD-2-Clause+
8
8
  authors:
9
9
  - Bertram Scharpf
data/README.md CHANGED
@@ -69,9 +69,6 @@ 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
- before the first Ruby code will be run.
74
-
75
72
  Additionally you can directly execute the buffers contents (here, I did
76
73
  `:set number`):
77
74
 
data/examples/passwords CHANGED
@@ -49,9 +49,9 @@ class Passwords
49
49
  client.echo [ [ key]], true, {}
50
50
  xsel key
51
51
  rescue
52
- client.err_writeln "No OTP under cursor?"
52
+ client.message_err "No OTP under cursor?"
53
53
  rescue ScriptError
54
- client.err_writeln $!.message
54
+ client.message_err $!.message
55
55
  end
56
56
  end
57
57
  end
data/lib/neovim/client.rb CHANGED
@@ -102,8 +102,11 @@ module Neovim
102
102
 
103
103
 
104
104
  def message str
105
- call_api :out_write, str
106
- str.end_with? $/ or call_api :out_write, $/
105
+ call_api :echo, [ [ str]], true, {}
106
+ end
107
+
108
+ def message_err msg
109
+ call_api :echo, [ [ msg]], true, err: true
107
110
  end
108
111
 
109
112
 
@@ -47,9 +47,10 @@ 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
50
+ if api_info["version"]["api_level"] < 13 then
51
+ log :warn, "Using nvim_err_writeln() which is deprecated in since Neovim 0.11.0"
52
+ @client.define_singleton_method :message_err do |msg|
53
+ call_api :err_writeln, msg
53
54
  end
54
55
  end
55
56
  nil
@@ -138,6 +139,7 @@ module Neovim
138
139
 
139
140
  def stdpath what
140
141
  cmd = [ path, "--headless", ]
142
+ cmd.push "-u", "NONE"
141
143
  cmd.push "-c", "echo stdpath(#{what.to_s.inspect})"
142
144
  cmd.push "-c", "q"
143
145
  (pipe_stderr cmd)&.tap { |x| x.chomp! }
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.8.0",
3
+ version: "1.9.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: "f393e6b"
10
+ commit: "a24b682"
data/lib/neovim/output.rb CHANGED
@@ -69,7 +69,7 @@ module Neovim
69
69
  else
70
70
  a = a.to_s
71
71
  write a
72
- write $/ unless a.end_with? $/
72
+ a.end_with? $/ or write $/
73
73
  end
74
74
  }
75
75
  end
@@ -90,27 +90,36 @@ module Neovim
90
90
  end
91
91
  end
92
92
  end
93
- end
94
-
95
- class WriteOut < WriteStd
93
+ def initialize *args
94
+ super
95
+ @str = ""
96
+ end
96
97
  def write *args
97
- args.each { |a|
98
- a = a.to_s
99
- a.notempty? or next
100
- @client.out_write a
101
- @line_open = !(a.end_with? $/)
102
- }
98
+ args.each { |a| @str << a.to_s }
99
+ loop do
100
+ l, r = @str.split $/, 2
101
+ r or break
102
+ write_line l
103
+ @str = r
104
+ end
103
105
  nil
104
106
  end
105
107
  def finish
106
- if @line_open then
107
- @client.out_write $/
108
- @line_open = nil
108
+ if @str.notempty? then
109
+ write_line @str
110
+ @str = nil
109
111
  end
110
112
  end
111
113
  end
112
114
 
113
- class WriteErr < Write
115
+ class WriteOut < WriteStd
116
+ private
117
+ def write_line l
118
+ @client.message l
119
+ end
120
+ end
121
+
122
+ class WriteErr < WriteStd
114
123
  class <<self
115
124
  def redirect *args, **kwargs
116
125
  open *args, **kwargs do |i|
@@ -121,52 +130,30 @@ module Neovim
121
130
  end
122
131
  end
123
132
  end
124
- def write *args
125
- args.each { |a|
126
- @rest ||= ""
127
- @rest << a.to_s
128
- while @rest =~ /#$// do
129
- @client.err_writeln $`
130
- @rest = $'
131
- end
132
- }
133
- nil
134
- end
135
- def finish
136
- if @rest.notempty? then
137
- @client.err_writeln @rest
138
- @rest = nil
139
- end
133
+ private
134
+ def write_line l
135
+ @client.message_err l
140
136
  end
141
137
  end
142
138
 
143
139
  class WriteBuf < WriteStd
144
140
  def initialize *args, whole: nil, top: nil
145
141
  super
146
- @lines, @last = [], ""
142
+ @lines = []
147
143
  @whole, @top = whole, top
148
144
  end
149
- def write *args
150
- args.each { |a| @last << a.to_s }
151
- loop do
152
- n, r = @last.split $/, 2
153
- r or break
154
- @lines.push n
155
- @last = r
156
- end
157
- nil
158
- end
159
145
  def finish
160
- if @last.notempty? then
161
- @lines.push @last
162
- @last = nil
163
- end
146
+ super
164
147
  if @whole then
165
148
  @client.buf_set_lines 0, 0, -1, true, @lines
166
149
  else
167
150
  @client.put @lines, "l", true, !@top
168
151
  end
169
152
  end
153
+ private
154
+ def write_line l
155
+ @lines.push l
156
+ end
170
157
  end
171
158
 
172
159
  end
@@ -88,7 +88,7 @@ module Neovim
88
88
  else
89
89
  line = $@.first[ /:(\d+):in\b/, 1]
90
90
  end
91
- client.err_writeln "Ruby #{$!.class}:#{line}: #{msg}"
91
+ client.message_err "Ruby #{$!.class}:#{line}: #{msg}"
92
92
  end
93
93
  end
94
94
 
@@ -121,23 +121,6 @@ module Neovim
121
121
  plugin_provider do |dsl|
122
122
 
123
123
  dsl.setup do |client|
124
- r = client.get_var "ruby_require" rescue nil
125
- case r
126
- when String then r = r.split
127
- when Array then
128
- when Hash then r = r.keys
129
- when nil then nil
130
- else r = [r.to_s]
131
- end
132
- if r.notempty? then
133
- WriteOut.redirect client do # Protect the RPC interface against erroneous output.
134
- r.each do |l|
135
- require l
136
- rescue LoadError
137
- client.out_write "Warning: #$!"
138
- end
139
- end
140
- end
141
124
  $curbuf = client.get_current_buf
142
125
  $curwin = client.get_current_win
143
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.8.0
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-30 00:00:00.000000000 Z
10
+ date: 2025-03-31 00:00:00.000000000 Z
11
11
  dependencies: []
12
12
  email: software@bertram-scharpf.de
13
13
  executables: