You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Refer to the [`Neovim` docs](https://www.rubydoc.info/github/neovim/neovim-ruby/main/Neovim) for other ways to connect to `nvim`, and the [`Neovim::Client` docs](https://www.rubydoc.info/github/neovim/neovim-ruby/main/Neovim/Client) for a summary of the client interface.
44
44
45
-
### Plugins
45
+
### Remote Modules
46
46
47
-
Plugins are Ruby files loaded from the `$VIMRUNTIME/rplugin/ruby/` directory. Here's an example plugin:
47
+
Remote modules allow users to define custom handlers in Ruby. To implement a remote module:
48
48
49
-
```ruby
50
-
# ~/.config/nvim/rplugin/ruby/example_plugin.rb
51
-
52
-
Neovim.plugin do |plug|
53
-
# Define a command called "SetLine" which sets the contents of the current
54
-
# line. This command is executed asynchronously, so the return value is
55
-
# ignored.
56
-
plug.command(:SetLine, nargs:1) do |nvim, str|
57
-
nvim.current.line = str
58
-
end
59
-
60
-
# Define a function called "Sum" which adds two numbers. This function is
61
-
# executed synchronously, so the result of the block will be returned to nvim.
62
-
plug.function(:Sum, nargs:2, sync:true) do |nvim, x, y|
63
-
x + y
64
-
end
65
-
66
-
# Define an autocmd for the BufEnter event on Ruby files.
67
-
plug.autocmd(:BufEnter, pattern:"*.rb") do |nvim|
68
-
nvim.command("echom 'Ruby file, eh?'")
69
-
end
70
-
end
71
-
```
49
+
- Define your handlers in a plain Ruby script that imports `neovim`
50
+
- Spawn the script from lua using `jobstart`
51
+
- Define commands in lua using `nvim_create_user_command` that route to the job's channel ID
72
52
73
-
When you add or update a plugin, you will need to call `:UpdateRemotePlugins` to update the remote plugin manifest. See `:help remote-plugin-manifest` for more information.
53
+
For details, see [`example_remote_module.lua`](spec/acceptance/runtime/plugin/example_remote_module.lua) and [`remote_module_spec.vim`](spec/acceptance/remote_module_spec.vim).
74
54
75
-
Refer to the [`Neovim::Plugin::DSL` docs](https://www.rubydoc.info/github/neovim/neovim-ruby/main/Neovim/Plugin/DSL) for a more complete overview of the `Neovim.plugin` DSL.
55
+
*Note*: Remote modules are a replacement for the deprecated "remote plugin" architecture. See https://github.com/neovim/neovim/issues/27949 for details.
0 commit comments