Awesome Open Source
Awesome Open Source

Github Actions

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

This example plugin adds the Hello command to Nvim.

package main

import (

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 to an executable named hello. Ensure that the executable is on your path.

// Use the go build to generate an executable
// Enusre this hello executable on your path
// you can move hello to your $GOPATH/bin
// or set the current dir into env variable `path`
go build -o hello

Add the following plugin to Nvim:

if exists('g:loaded_hello')
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})

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:

:echo Hello('world')

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
go (13,852
neovim (269
neovim-plugin (51
msgpack (34

Find Open Source By Browsing 7,000 Topics Across 59 Categories