Go client for Neovim
Go
Latest commit b4d0001 Dec 18, 2016 @garyburd garyburd committed on GitHub Update README.md
Replace deprecated call to `rpcstart` with call to `jobstart`.
Permalink
Failed to load latest commit information.
msgpack Execute notifications in order Nov 8, 2016
nvim Improve documentation (#8) Dec 7, 2016
.gitignore First commit Sep 26, 2016
.travis.yml First commit Sep 26, 2016
LICENSE Change license to Apache 2 Sep 27, 2016
README.md Update README.md Dec 18, 2016

README.md

GoDoc Build Status

Neovim/go-client is a Neovim client and plugin host for Go.

This example plugin adds the Hello command to Nvim:

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
    })
}

To add this plugin to Nvim, build the program with the go tool and add this plugin to Vim:

if exists('g:loaded_hello')
  finish
endif
let g:loaded_hello = 1

function! s:Requirehello(host) abort
  return jobstart(['junk'], {'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