Module: Neovim
- Defined in:
- lib/neovim/meta.rb,
lib/neovim.rb,
lib/neovim/host.rb,
lib/neovim/client.rb,
lib/neovim/remote.rb,
lib/neovim/handler.rb,
lib/neovim/logging.rb,
lib/neovim/session.rb,
lib/neovim/messager.rb,
lib/neovim/connection.rb,
lib/neovim/remote_object.rb,
lib/neovim/ruby_provider.rb,
lib/neovim/vimscript_provider.rb
Overview
neovim/meta.rb – Metadata: Version info etc.
Defined Under Namespace
Modules: Logging, OptionAccess
Classes: Buffer, Client, Connection, ConnectionChild, ConnectionStdio, ConnectionTcp, ConnectionUnix, DslBase, DslPlain, DslProvider, DslRemote, DslVimscript, Handler, Host, Messager, Meta, Remote, RemoteObject, Session, Tabpage, Window, Write, WriteBuf, WriteErr, WriteOut, WriteStd
Constant Summary
collapse
- INFO =
Neovim::Meta.new "nvim",
version: "1.0.0",
license: "BSD-2-Clause+",
authors: ["Bertram Scharpf"],
email: "[email protected]",
summary: "Yet another Ruby client for Neovim",
description: "A simple Ruby client for Neovim.\nClean code, minimal dependecies, no frills, no wokeness.",
homepage: "http://bertram-scharpf.de",
commit: "e927f7e"
Class Method Summary
collapse
Class Method Details
.build_sum(lines) ⇒ Object
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
|
# File 'lib/neovim/ruby_provider.rb', line 223
def build_sum lines
require "bigdecimal"
sum = BigDecimal 0
prev, decs = 0, 0
sep = "."
lines.each { |l|
l.slice! /^.*:/
l.slice! /#.*/
l = l.split /(?:\+\s+|\|)/
l.map! { |m|
m.strip!
if m =~ %r/ *%\z/ then
prev * (BigDecimal $`) / 100
else
m = m.split "*"
m.map! { |n|
n.sub! /,/ do sep = $& ; "." end
n.sub! /\.(?:-+|([0-9]+))/ do
if $1 then
d = $1.length
decs = d if decs < d
".#$1"
else
decs = 2
nil
end
end
BigDecimal n
}
prev = m.inject do |p,e| p*e end
end
}
sum = l.inject sum do |s,e| s+e end
}
sum = sum.round decs
case sum
when BigDecimal then
sum = sum.to_s "F"
sum.sub! /(?:\.([0-9]+))?\z/ do
sep + ($1.to_s.ljust decs, "0")
end
when Integer then
sum = sum.to_s
end
sum
end
|
.get_lines(client, range) ⇒ Object
215
216
217
|
# File 'lib/neovim/ruby_provider.rb', line 215
def get_lines client, range
client.buf_get_lines 0, range.begin-1, range.end, true
end
|
.plugin_provider(&block) ⇒ Object
219
220
221
|
# File 'lib/neovim/ruby_provider.rb', line 219
def plugin_provider &block
run_dsl DslProvider, &block
end
|
.set_global_client(client) ⇒ Object
198
199
200
201
202
203
|
# File 'lib/neovim/ruby_provider.rb', line 198
def set_global_client client
$vim = client
yield
ensure
$vim = nil
end
|
.set_globals(client, range) ⇒ Object
205
206
207
208
209
210
211
212
213
|
# File 'lib/neovim/ruby_provider.rb', line 205
def set_globals client, range
set_global_client client do
lines = get_lines client, range
$range, $lines = range, lines
yield lines
end
ensure
$range, $lines = nil, nil
end
|
.start_remote(&block) ⇒ Object
12
13
14
15
16
17
|
# File 'lib/neovim.rb', line 12
def start_remote &block
Host.run do |h|
DslRemote.open :remote, h, &block
h.start
end
end
|