nvim 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,60 @@
1
+ #
2
+ # neovim/session.rb -- Sessions
3
+ #
4
+
5
+ require "neovim/foreign/supplement"
6
+
7
+ require "neovim/logging"
8
+ require "neovim/connection"
9
+ require "neovim/messager"
10
+
11
+
12
+ module Neovim
13
+
14
+ class Session
15
+
16
+ include Logging
17
+
18
+ class <<self
19
+
20
+ private :new
21
+
22
+ def open conntype, *args, **kwargs
23
+ conntype.open_files *args, **kwargs do |conn|
24
+ yield (new conn)
25
+ end
26
+ end
27
+
28
+ include Logging
29
+
30
+ def start *args
31
+ open_logfile do
32
+ log :info, "Starting", args: $*
33
+ open *args do |i|
34
+ yield i
35
+ end
36
+ ensure
37
+ log :info, "Leaving"
38
+ end
39
+ end
40
+
41
+ end
42
+
43
+ def initialize conn
44
+ @conn = conn
45
+ @comm = Messager.new @conn, self
46
+ end
47
+
48
+ def execute_handler name, args
49
+ raise "No handler found for #{name.inspect}."
50
+ end
51
+
52
+
53
+ def run ; @comm.run ; end
54
+ def request method, *args ; @comm.request method, *args ; end
55
+ def notify method, *args ; @comm.notify method, *args ; end
56
+
57
+ end
58
+
59
+ end
60
+
@@ -0,0 +1,49 @@
1
+ #
2
+ # neovim/vimscript_provider.rb -- Remote Plugin
3
+ #
4
+
5
+ require "neovim/handler"
6
+
7
+
8
+ module Neovim
9
+
10
+ class DslVimscript < DslBase
11
+
12
+ TYPE = :rplugin
13
+
14
+ def initialize source
15
+ super
16
+ @source = source
17
+ end
18
+
19
+ def command name, sync: true, **options, &block
20
+ # Options: range/count bang register nargs complete bar
21
+ register_handler :command, name, sync, **options, &block
22
+ end
23
+
24
+ def function name, sync: true, **options, &block
25
+ # Options: range eval
26
+ register_handler :function, name, sync, **options, &block
27
+ end
28
+
29
+ def autocmd event, **options, &block
30
+ # Options: group pattern nested once eval
31
+ register_handler :autocmd, event, true, **options, &block
32
+ end
33
+
34
+ private
35
+
36
+ def register_handler type, name, sync, **opts
37
+ acp = opts[ :pattern]||"*" if type == :autocmd
38
+ qn = [ @source, type, name, *acp].join ":"
39
+ add_handler qn, name, type, sync, **opts do |client,*args|
40
+ args, range, evaled = *args
41
+ range = Range.new *range if range
42
+ yield client, args, range, evaled
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+
data/lib/neovim.rb ADDED
@@ -0,0 +1,22 @@
1
+ #
2
+ # neovim.rb -- Basic methods
3
+ #
4
+
5
+ require "neovim/host"
6
+
7
+
8
+ module Neovim
9
+
10
+ class <<self
11
+
12
+ def start_remote &block
13
+ Host.run do |h|
14
+ DslRemote.open :remote, h, &block
15
+ h.start
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
22
+
metadata ADDED
@@ -0,0 +1,66 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nvim
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Bertram Scharpf
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-07-13 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: software@bertram-scharpf.de
15
+ executables:
16
+ - neovim-ruby-host
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - INFO.yaml
21
+ - LICENSE
22
+ - README.md
23
+ - Rakefile
24
+ - bin/neovim-ruby-host
25
+ - lib/neovim.rb
26
+ - lib/neovim/client.rb
27
+ - lib/neovim/connection.rb
28
+ - lib/neovim/foreign/mplight.rb
29
+ - lib/neovim/foreign/mplight/bufferio.rb
30
+ - lib/neovim/foreign/supplement.rb
31
+ - lib/neovim/foreign/supplement/socket.rb
32
+ - lib/neovim/handler.rb
33
+ - lib/neovim/host.rb
34
+ - lib/neovim/info.rb
35
+ - lib/neovim/logging.rb
36
+ - lib/neovim/messager.rb
37
+ - lib/neovim/meta.rb
38
+ - lib/neovim/remote.rb
39
+ - lib/neovim/remote_object.rb
40
+ - lib/neovim/ruby_provider.rb
41
+ - lib/neovim/session.rb
42
+ - lib/neovim/vimscript_provider.rb
43
+ homepage: http://bertram-scharpf.de
44
+ licenses:
45
+ - BSD-2-Clause+
46
+ metadata: {}
47
+ post_install_message:
48
+ rdoc_options: []
49
+ require_paths:
50
+ - lib
51
+ required_ruby_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 3.0.0
56
+ required_rubygems_version: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ requirements: []
62
+ rubygems_version: 3.5.6
63
+ signing_key:
64
+ specification_version: 4
65
+ summary: Yet another Ruby client for Neovim
66
+ test_files: []