-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare to deprecate support for remote plugins
Neovim plans to deprecate remote plugins as described at neovim/neovim#27949. This commit removes references to remote plugins from all directories except nvim/plugin. We will wait for the completion of neovim/neovim#27949 before marking the `github.com/go-client/nvim/plugin` package as deprecated.
- Loading branch information
Showing
4 changed files
with
76 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
Status | ||
------ | ||
|
||
This package will be deprecated when Neovim [removes the concept of | ||
remote plugins](https://github.com/neovim/neovim/issues/27949). | ||
|
||
|
||
Example | ||
------- | ||
|
||
This example plugin adds the Hello command to Nvim. | ||
|
||
```go | ||
package main | ||
|
||
import ( | ||
"strings" | ||
"github.com/neovim/go-client/nvim/plugin" | ||
) | ||
|
||
func hello(args []string) (string, error) { | ||
return "Hello " + strings.Join(args, " "), nil | ||
} | ||
|
||
func main() { | ||
plugin.Main(func(p *plugin.Plugin) error { | ||
p.HandleFunction(&plugin.FunctionOptions{Name: "Hello"}, hello) | ||
return nil | ||
}) | ||
} | ||
``` | ||
|
||
Build the program with the [go tool](https://golang.org/cmd/go/) to an | ||
executable named `hello`. Ensure that the executable is in a directory in | ||
the `PATH` environment variable. | ||
|
||
```bash | ||
// Use the `go build` command to generate an executable. | ||
// To ensure this "hello" executable is on your path, | ||
// you can move "hello" to your $GOPATH/bin directory | ||
// or add the current directory to the `PATH` environment variable. | ||
go build -o hello | ||
``` | ||
|
||
Add the following plugin to Nvim: | ||
|
||
```vim | ||
if exists('g:loaded_hello') | ||
finish | ||
endif | ||
let g:loaded_hello = 1 | ||
function! s:Requirehello(host) abort | ||
" 'hello' is the binary created by compiling the program above. | ||
return jobstart(['hello'], {'rpc': v:true}) | ||
endfunction | ||
call remote#host#Register('hello', 'x', function('s:Requirehello')) | ||
" The following lines are generated by running the program | ||
" command line flag --manifest hello | ||
call remote#host#RegisterPlugin('hello', '0', [ | ||
\ {'type': 'function', 'name': 'Hello', 'sync': 1, 'opts': {}}, | ||
\ ]) | ||
" vim:ts=4:sw=4:et | ||
``` | ||
|
||
Start Nvim and run the following command: | ||
|
||
```vim | ||
:echo Hello('world') | ||
``` | ||
|
||
|