Module: Neovim
- Defined in:
- lib/neovim/meta.rb,
lib/neovim.rb,
lib/neovim/host.rb,
lib/neovim/client.rb,
lib/neovim/output.rb,
lib/neovim/remote.rb,
lib/neovim/handler.rb,
lib/neovim/logging.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, HandlerPlain, Host, Job, Meta, Provider, Remote, RemoteObject, Tabpage, Window, Write, WriteBuf, WriteErr, WriteOut, WriteStd
Constant Summary
collapse
- INFO =
Neovim::Meta.new "nvim",
version: "1.1.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: "https://github.com/BertramScharpf/ruby-nvim",
commit: "45c1473"
Class Method Summary
collapse
Class Method Details
.build_sum(lines) ⇒ Object
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
# File 'lib/neovim/ruby_provider.rb', line 120
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
112
113
114
|
# File 'lib/neovim/ruby_provider.rb', line 112
def get_lines client, range
client.buf_get_lines 0, range.begin-1, range.end, true
end
|
.mk_plugins(&block) ⇒ Object
25
26
27
|
# File 'lib/neovim.rb', line 25
def mk_plugins &block
{ remote: (DslRemote.open &block) }
end
|
.plugin_provider(&block) ⇒ Object
116
117
118
|
# File 'lib/neovim/ruby_provider.rb', line 116
def plugin_provider &block
run_dsl DslProvider, &block
end
|
.set_global_client(client) ⇒ Object
95
96
97
98
99
100
|
# File 'lib/neovim/ruby_provider.rb', line 95
def set_global_client client
$vim = client
yield
ensure
$vim = nil
end
|
.set_globals(client, range) ⇒ Object
102
103
104
105
106
107
108
109
110
|
# File 'lib/neovim/ruby_provider.rb', line 102
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
21
22
23
|
# File 'lib/neovim.rb', line 21
def start_remote &block
Job.run mk_plugins &block
end
|