go-client


Ⅰ. 插件描述

Nvim Go client

Ⅱ. 基本信息

创建日期:  2014-11-13
使用用户:  2
Github星:  219
插件作者:  Neovim

Ⅲ. 安装方法

使用Vundle管理器安装

在你的.vimrc下添加:
Plugin 'neovim/go-client'
… 然后在Vim中运行以下命令:
:source %
:PluginInstall

对于Vundle版本 < 0.10.2,请用上面的Bundle替换Plugin。

使用NeoBundle管理器安装

在你的.vimrc下添加:
NeoBundle 'neovim/go-client'
… 然后在Vim中运行以下命令:
:source %
:NeoBundleInstall

使用VimPlug管理器安装

在你的.vimrc下添加:
Plug 'neovim/go-client'
… 然后在Vim中运行以下命令:
:source %
:PlugInstall

使用Pathogen管理器安装

在终端中运行以下命令:
cd ~/.vim/bundle
git clone https://github.com/neovim/go-client

Ⅳ. 文档说明

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

Build the program with the go tool to an
executable named hello. Ensure that the executable is on your path.

Add the following plugin to Nvim:

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:

:echo Hello('world')

添加新评论