nvim 1.5.1 → 1.6.1
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/LICENSE +1 -1
- data/README.md +51 -5
- data/Rakefile +1 -1
- data/lib/neovim/client.rb +0 -3
- data/lib/neovim/foreign/{xxd.rb → nxxd.rb} +58 -37
- data/lib/neovim/info.rb +2 -2
- data/lib/neovim/remote_object.rb +3 -0
- data/lib/neovim/ruby_provider.rb +10 -4
- data/nvim.gemspec +1 -0
- metadata +3 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: d91e5ad07b2fd0ea6dd1da251df0e55dad1312b3ac4fa585cae59658dbccf666
         | 
| 4 | 
            +
              data.tar.gz: bde8ff51d7a22f70aca3c58f83051b32357f0d56603bdbd7ce209ce6acf94de9
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c5d55983ed98e326fe1a5a6c15e764ac0a3aff858dadf3538c6edcee5339d7fb117b33984d80334d2fb18d7f8fbd505d89ca854aec09bbbf6513c07b5f9c48ee
         | 
| 7 | 
            +
              data.tar.gz: c7dc22c69ddcb550b1d1a412963788b33f77337f5520ea87bc4bf2edabed162bcd59402e605eac6a46109c1953994024f88211c2d21af12efb9722e3eab36422
         | 
    
        data/INFO.yaml
    CHANGED
    
    
    
        data/LICENSE
    CHANGED
    
    | @@ -1,6 +1,6 @@ | |
| 1 1 | 
             
            # BSD-2-clause license, extended by language use conditions
         | 
| 2 2 |  | 
| 3 | 
            -
            Copyright (C) 2024, Bertram Scharpf <software@bertram-scharpf.de>.
         | 
| 3 | 
            +
            Copyright (C) 2024-2025, Bertram Scharpf <software@bertram-scharpf.de>.
         | 
| 4 4 | 
             
            All rights reserved.
         | 
| 5 5 |  | 
| 6 6 | 
             
            Redistribution and use in source and binary forms, with or without
         | 
    
        data/README.md
    CHANGED
    
    | @@ -207,6 +207,52 @@ Yet, you should avoid to use `fork` and `exec`, except when | |
| 207 207 | 
             
            you're absolutely sure what you're doing.
         | 
| 208 208 |  | 
| 209 209 |  | 
| 210 | 
            +
            #### Global variables
         | 
| 211 | 
            +
             | 
| 212 | 
            +
            The global variable `$vim` will be set to the client.
         | 
| 213 | 
            +
             | 
| 214 | 
            +
            ```
         | 
| 215 | 
            +
            ~
         | 
| 216 | 
            +
            ~
         | 
| 217 | 
            +
            :ruby $vim.command "split"
         | 
| 218 | 
            +
            ```
         | 
| 219 | 
            +
             | 
| 220 | 
            +
            Further, the variables `$range` and `$lines` will be set.
         | 
| 221 | 
            +
             | 
| 222 | 
            +
            ```
         | 
| 223 | 
            +
             1 foo
         | 
| 224 | 
            +
             2 bar
         | 
| 225 | 
            +
             3 baz
         | 
| 226 | 
            +
            ~
         | 
| 227 | 
            +
            :%ruby puts $range.inspect, $lines.inspect
         | 
| 228 | 
            +
            ```
         | 
| 229 | 
            +
             | 
| 230 | 
            +
            The legacy variables `$curbuf` and `$curwin` are supported.
         | 
| 231 | 
            +
             | 
| 232 | 
            +
            ```
         | 
| 233 | 
            +
            ~
         | 
| 234 | 
            +
            ~
         | 
| 235 | 
            +
            :ruby puts $curbuf.get_name, $curwin.get_height
         | 
| 236 | 
            +
            ```
         | 
| 237 | 
            +
             | 
| 238 | 
            +
             | 
| 239 | 
            +
            ### Requiring Ruby files
         | 
| 240 | 
            +
             | 
| 241 | 
            +
            In addition to the `:rubyfile` command as documented, that command can also be
         | 
| 242 | 
            +
            used to just require a Ruby file. Set the name into angle brackets, and the
         | 
| 243 | 
            +
            file will be searched in `$:`. Sorry, file name completion will not work.
         | 
| 244 | 
            +
             | 
| 245 | 
            +
            ```
         | 
| 246 | 
            +
            ~
         | 
| 247 | 
            +
            ~
         | 
| 248 | 
            +
            :rubyfile <yaml>
         | 
| 249 | 
            +
            ```
         | 
| 250 | 
            +
             | 
| 251 | 
            +
            In this case, the global variables `$range` and `$lines` will not be set. Yet,
         | 
| 252 | 
            +
            `$vim` still will be available. See the
         | 
| 253 | 
            +
            [Nxxd](https://github.com/BertramScharpf/ruby-nxxd) gem for a nice example.
         | 
| 254 | 
            +
             | 
| 255 | 
            +
             | 
| 210 256 | 
             
            ### List all API functions
         | 
| 211 257 |  | 
| 212 258 | 
             
            To show a list of the API functions call something like this:
         | 
| @@ -365,7 +411,7 @@ main:1:004> \q!! | |
| 365 411 | 
             
            Put text into an X selection or a TMux register.
         | 
| 366 412 |  | 
| 367 413 | 
             
            ```vim
         | 
| 368 | 
            -
             | 
| 414 | 
            +
            rubyfile <neovim/tools/copy>
         | 
| 369 415 | 
             
            '<,'>ruby xsel $lines
         | 
| 370 416 | 
             
            '<,'>ruby xsel! $lines
         | 
| 371 417 | 
             
            '<,'>ruby tmuxbuf $lines
         | 
| @@ -375,16 +421,16 @@ Make a hex dump. | |
| 375 421 |  | 
| 376 422 | 
             
            ```vim
         | 
| 377 423 | 
             
            ruby <<EOT
         | 
| 378 | 
            -
              require "neovim/foreign/ | 
| 424 | 
            +
              require "neovim/foreign/nxxd"
         | 
| 379 425 | 
             
              bn = $curbuf.get_name
         | 
| 380 | 
            -
              $vim.command : | 
| 381 | 
            -
              File.open bn do |b|  | 
| 426 | 
            +
              $vim.command :enew!
         | 
| 427 | 
            +
              File.open bn do |b| Nxxd::Dump.new.run b do |l| $vim.put [l], "l", false, true end end
         | 
| 382 428 | 
             
            EOT
         | 
| 383 429 | 
             
            ```
         | 
| 384 430 |  | 
| 385 431 |  | 
| 386 432 | 
             
            ## Copyright
         | 
| 387 433 |  | 
| 388 | 
            -
              * (C) 2024 Bertram Scharpf <software@bertram-scharpf.de>
         | 
| 434 | 
            +
              * (C) 2024,2025 Bertram Scharpf <software@bertram-scharpf.de>
         | 
| 389 435 | 
             
              * License: [BSD-2-Clause+](./LICENSE)
         | 
| 390 436 |  | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/lib/neovim/client.rb
    CHANGED
    
    
| @@ -1,19 +1,20 @@ | |
| 1 1 | 
             
            #
         | 
| 2 | 
            -
            #  neovim/foreign/ | 
| 2 | 
            +
            #  neovim/foreign/nxxd.rb  --  Hex Dump Tool
         | 
| 3 3 | 
             
            #
         | 
| 4 4 |  | 
| 5 5 | 
             
            # The purpose of this is simply to reduce dependencies.
         | 
| 6 6 |  | 
| 7 7 | 
             
            begin
         | 
| 8 | 
            -
              require " | 
| 8 | 
            +
              require "nxxd"
         | 
| 9 9 | 
             
            rescue LoadError
         | 
| 10 10 |  | 
| 11 11 | 
             
            # ----------------------------------------------------------------
         | 
| 12 12 | 
             
            #
         | 
| 13 | 
            -
            #   | 
| 13 | 
            +
            #  nxxd.rb  --  Hex Dump Tool
         | 
| 14 14 | 
             
            #
         | 
| 15 15 |  | 
| 16 | 
            -
             | 
| 16 | 
            +
             | 
| 17 | 
            +
            module Nxxd
         | 
| 17 18 |  | 
| 18 19 | 
             
              module ReadChunks
         | 
| 19 20 |  | 
| @@ -87,53 +88,44 @@ module Xxd | |
| 87 88 | 
             
                    addr += b.size
         | 
| 88 89 | 
             
                  end
         | 
| 89 90 | 
             
                  yield @addr_fmt % addr
         | 
| 91 | 
            +
                  nil
         | 
| 90 92 | 
             
                end
         | 
| 91 93 |  | 
| 94 | 
            +
             | 
| 92 95 | 
             
                class <<self
         | 
| 93 96 |  | 
| 94 | 
            -
                  def reverse input
         | 
| 95 | 
            -
                     | 
| 96 | 
            -
                     | 
| 97 | 
            -
                     | 
| 97 | 
            +
                  def reverse input, output = nil
         | 
| 98 | 
            +
                    output ||= ""
         | 
| 99 | 
            +
                    o = String === output ? (WriteChunksString.new output) : output
         | 
| 100 | 
            +
                    o.set_encoding Encoding::ASCII_8BIT
         | 
| 101 | 
            +
                    r, repeat = nil, false
         | 
| 98 102 | 
             
                    input.each_line { |l|
         | 
| 103 | 
            +
                      l.chomp!
         | 
| 99 104 | 
             
                      case l
         | 
| 100 | 
            -
                        when /^\s | 
| 101 | 
            -
                        when /^\*/ | 
| 102 | 
            -
                         | 
| 103 | 
            -
                           | 
| 105 | 
            +
                        when /^\s*(?:#|$)/                  then nil
         | 
| 106 | 
            +
                        when /^\*/                          then repeat = true
         | 
| 107 | 
            +
                        when /^(?:(\h+):)?\s*((?:\h\h ?)*)/ then
         | 
| 108 | 
            +
                          addr, nibs = $~.captures
         | 
| 109 | 
            +
                          if addr then
         | 
| 104 110 | 
             
                            addr = $1.to_i 0x10
         | 
| 105 111 | 
             
                            if repeat then
         | 
| 106 | 
            -
                               | 
| 107 | 
            -
                                 | 
| 108 | 
            -
                                 | 
| 109 | 
            -
             | 
| 110 | 
            -
                              if pos < addr then
         | 
| 111 | 
            -
                                yield r[ 0, addr - pos]
         | 
| 112 | 
            -
                                pos = addr
         | 
| 112 | 
            +
                              loop do
         | 
| 113 | 
            +
                                s = addr - o.tell
         | 
| 114 | 
            +
                                break if s <= 0
         | 
| 115 | 
            +
                                o.write s >= r.length ? r : r[ 0, s]
         | 
| 113 116 | 
             
                              end
         | 
| 114 117 | 
             
                              repeat = false
         | 
| 115 118 | 
             
                            else
         | 
| 116 | 
            -
                              if pos < addr then
         | 
| 117 | 
            -
                                r = ([0].pack "C*") * (addr - pos)
         | 
| 118 | 
            -
                                yield r
         | 
| 119 | 
            -
                                pos = addr
         | 
| 120 | 
            -
                              elsif pos > addr then
         | 
| 121 | 
            -
                                yield nil, addr
         | 
| 122 | 
            -
                                pos = addr
         | 
| 123 | 
            -
                              end
         | 
| 124 119 | 
             
                            end
         | 
| 120 | 
            +
                            o.seek addr
         | 
| 125 121 | 
             
                          end
         | 
| 126 | 
            -
                           | 
| 127 | 
            -
                           | 
| 128 | 
            -
             | 
| 129 | 
            -
                           | 
| 130 | 
            -
                          if row.any? then
         | 
| 131 | 
            -
                            r = row.pack "C*"
         | 
| 132 | 
            -
                            yield r
         | 
| 133 | 
            -
                            pos += r.length
         | 
| 134 | 
            -
                          end
         | 
| 122 | 
            +
                          r = (nibs.scan /\h\h/).map { |x| x.to_i 0x10 }.pack "C*"
         | 
| 123 | 
            +
                          o.write r
         | 
| 124 | 
            +
                        else
         | 
| 125 | 
            +
                          raise "Uninterpretable hex dump: #{l.chomp}"
         | 
| 135 126 | 
             
                      end
         | 
| 136 127 | 
             
                    }
         | 
| 128 | 
            +
                    output
         | 
| 137 129 | 
             
                  end
         | 
| 138 130 |  | 
| 139 131 | 
             
                end
         | 
| @@ -161,12 +153,13 @@ module Xxd | |
| 161 153 | 
             
                def run input, &block
         | 
| 162 154 | 
             
                  if @varname then
         | 
| 163 155 | 
             
                    yield "unsigned char #@varname[] = {"
         | 
| 164 | 
            -
                    yield "};"
         | 
| 165 156 | 
             
                    len = run_plain input, &block
         | 
| 157 | 
            +
                    yield "};"
         | 
| 166 158 | 
             
                    yield "unsigned int #@varname\_len = %d;" % len
         | 
| 167 159 | 
             
                  else
         | 
| 168 160 | 
             
                    run_plain input, &block
         | 
| 169 161 | 
             
                  end
         | 
| 162 | 
            +
                  nil
         | 
| 170 163 | 
             
                end
         | 
| 171 164 |  | 
| 172 165 | 
             
                private
         | 
| @@ -187,6 +180,34 @@ module Xxd | |
| 187 180 |  | 
| 188 181 | 
             
              end
         | 
| 189 182 |  | 
| 183 | 
            +
              class WriteChunksString
         | 
| 184 | 
            +
                def initialize str
         | 
| 185 | 
            +
                  @str = str
         | 
| 186 | 
            +
                end
         | 
| 187 | 
            +
                def set_encoding enc
         | 
| 188 | 
            +
                  @str.force_encoding enc
         | 
| 189 | 
            +
                end
         | 
| 190 | 
            +
                def tell ; @pos || @str.length ; end
         | 
| 191 | 
            +
                def seek pos
         | 
| 192 | 
            +
                  s = pos - @str.length
         | 
| 193 | 
            +
                  if s >= 0 then
         | 
| 194 | 
            +
                    s.times { @str << "\0".b }
         | 
| 195 | 
            +
                  else
         | 
| 196 | 
            +
                    @pos = pos
         | 
| 197 | 
            +
                  end
         | 
| 198 | 
            +
                end
         | 
| 199 | 
            +
                def write b
         | 
| 200 | 
            +
                  if @pos then
         | 
| 201 | 
            +
                    l = b.length
         | 
| 202 | 
            +
                    @str[ @pos, l] = b
         | 
| 203 | 
            +
                    @pos += l
         | 
| 204 | 
            +
                    @pos = nil if @pos >= @str.length
         | 
| 205 | 
            +
                  else
         | 
| 206 | 
            +
                    @str << b
         | 
| 207 | 
            +
                  end
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
              end
         | 
| 210 | 
            +
             | 
| 190 211 | 
             
            end
         | 
| 191 212 |  | 
| 192 213 | 
             
            # ----------------------------------------------------------------
         | 
    
        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.6.1",
         | 
| 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: "4e96338"
         | 
    
        data/lib/neovim/remote_object.rb
    CHANGED
    
    
    
        data/lib/neovim/ruby_provider.rb
    CHANGED
    
    | @@ -203,11 +203,17 @@ module Neovim | |
| 203 203 |  | 
| 204 204 | 
             
                # This is called by the +:rubyfile+ command.
         | 
| 205 205 | 
             
                dsl.rpc :ruby_execute_file do |client,path,fst,lst|
         | 
| 206 | 
            -
                   | 
| 207 | 
            -
                     | 
| 208 | 
            -
             | 
| 206 | 
            +
                  if path =~ /<(.*)>\z/ then
         | 
| 207 | 
            +
                    set_global_client client do
         | 
| 208 | 
            +
                      require $1
         | 
| 209 | 
            +
                    end
         | 
| 210 | 
            +
                  else
         | 
| 211 | 
            +
                    set_globals client, fst..lst do ||
         | 
| 212 | 
            +
                      r = File.read path
         | 
| 213 | 
            +
                      script_binding.eval r, "ruby_file #{path}"
         | 
| 214 | 
            +
                    end
         | 
| 215 | 
            +
                    nil
         | 
| 209 216 | 
             
                  end
         | 
| 210 | 
            -
                  nil
         | 
| 211 217 | 
             
                end
         | 
| 212 218 |  | 
| 213 219 | 
             
                # This is called by the +:rubydo+ command.
         | 
    
        data/nvim.gemspec
    CHANGED
    
    
    
        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.6.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Bertram Scharpf
         | 
| 8 8 | 
             
            bindir: bin
         | 
| 9 9 | 
             
            cert_chain: []
         | 
| 10 | 
            -
            date: 2025- | 
| 10 | 
            +
            date: 2025-02-02 00:00:00.000000000 Z
         | 
| 11 11 | 
             
            dependencies: []
         | 
| 12 12 | 
             
            email: software@bertram-scharpf.de
         | 
| 13 13 | 
             
            executables:
         | 
| @@ -46,9 +46,9 @@ files: | |
| 46 46 | 
             
            - lib/neovim/connection.rb
         | 
| 47 47 | 
             
            - lib/neovim/foreign/mplight.rb
         | 
| 48 48 | 
             
            - lib/neovim/foreign/mplight/bufferio.rb
         | 
| 49 | 
            +
            - lib/neovim/foreign/nxxd.rb
         | 
| 49 50 | 
             
            - lib/neovim/foreign/supplement.rb
         | 
| 50 51 | 
             
            - lib/neovim/foreign/supplement/socket.rb
         | 
| 51 | 
            -
            - lib/neovim/foreign/xxd.rb
         | 
| 52 52 | 
             
            - lib/neovim/handler.rb
         | 
| 53 53 | 
             
            - lib/neovim/host.rb
         | 
| 54 54 | 
             
            - lib/neovim/info.rb
         |