func NewClient(im InitMethod, c io.ReadWriteCloser, log Logger) (*Client, error) {
	if log == nil {
		log = _log.New(os.Stderr, "neovim ", _log.Llongfile|_log.Ldate|_log.Ltime)
	}
	res := &Client{rw: c}
	res.respMap = newRespSyncMap()
	res.syncProvMap = newSyncProvSyncMap()
	res.asyncProvMap = newAsyncProvSyncMap()
	res.dec = msgp.NewReader(c)
	res.enc = msgp.NewWriter(c)
	res.log = log
	res.KillChannel = make(chan struct{})
	err := res.syncProvMap.Put(_MethodInit, NewSyncDecoderOptions{NewSyncDecoder: func() SyncDecoder {
		res := &InitMethodWrapper{InitMethod: im, Client: res, args: &InitMethodArgs{}, results: &InitMethodRetVals{}}
		return res
	}, MethodOptions: &MethodOptions{Type: FUNCTION}})
	if err != nil {
		return nil, errors.Annotatef(err, "Could not add init method handler")
	}
	return res, nil
}
NewClient creates a new Client
package neovim
import (
	"io"
	_log "log"
	"net"
	"os"
	"os/exec"
	"sync/atomic"
	"github.com/juju/errors"
	"github.com/myitcv/neovim/apidef"
	"github.com/tinylib/msgp/msgp"
)
func NewUnixClient(im InitMethod, _net string, laddr, raddr *net.UnixAddr, log Logger) (*Client, error) {
	c, err := net.DialUnix(_net, laddr, raddr)
	if err != nil {
		return nil, errors.Annotatef(err, "could not establish connection to Neovim, _net %v, laddr %v, %v", _net, laddr, raddr)
	}
	return NewClient(im, c, log)
}
func NewCmdClient(im InitMethod, c *exec.Cmd, log Logger) (*Client, error) {
	stdin, err := c.StdinPipe()
	if err != nil {
		return nil, errors.Annotatef(err, "could not get a stdin pipe to embedded nvim")
	}
	stdout, err := c.StdoutPipe()
	if err != nil {
		return nil, errors.Annotatef(err, "could not get a stdout pipe to embedded nvim")
	}
	wrap := &StdWrapper{Stdin: stdin, Stdout: stdout}
	found := false
	for i := range c.Args {
		if c.Args[i] == "--embed" {
			found = true
		}
	}
	if !found {
		c.Args = append(c.Args, "--embed", "-N")
	}
	err = c.Start()
	if err != nil {
		return nil, errors.Annotatef(err, "could not start the embedded nvim")
	}
	return NewClient(im, wrap, log)
}