Documentation
¶
Overview ¶
Package vim provides Vim client and server implementations. You can start Vim as a server as a child process or connect to Vim, and communicate with it via TCP or stdin/stdout. :h channel.txt
Index ¶
- Variables
- func NewChildClient(handler Handler, args []string) (*Client, *ChildCliCloser, error)
- func NewReadWriter(r io.Reader, w io.Writer) io.ReadWriter
- func SetLogger(l *log.Logger)
- type Body
- type ChildCliCloser
- type Client
- func (cli *Client) Call(funcname string, args ...interface{}) (Body, error)
- func (cli *Client) Ex(cmd string) error
- func (cli *Client) Expr(expr string) (Body, error)
- func (cli *Client) Normal(ncmd string) error
- func (cli *Client) Redraw(force string) error
- func (cli *Client) Send(msg *Message) error
- func (cli *Client) Start() error
- func (cli *Client) Write(p []byte) (n int, err error)
- type Handler
- type Message
- type Process
- type Server
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExpr = errors.New("the evaluation fails or the result can't be encoded in JSON")
ErrExpr represents "expr" command error.
var ErrTimeOut = errors.New("time out")
ErrTimeOut represents time out error.
Functions ¶
func NewChildClient ¶
func NewChildClient(handler Handler, args []string) (*Client, *ChildCliCloser, error)
NewChildClient creates connected child process Vim client.
func NewReadWriter ¶
NewReadWriter returns simple io.ReadWriter. bufio.ReadWriter has buffers and needs to be flushed., so we cannot use bufio.NewReadWriter() for Vim client which accept io.ReadWriter. ref: https://groups.google.com/forum/#!topic/golang-nuts/OJnnwlfsPCc
Types ¶
type ChildCliCloser ¶
type ChildCliCloser struct {
// contains filtered or unexported fields
}
ChildCliCloser is closer of child Vim client process.
func (*ChildCliCloser) Close ¶
func (c *ChildCliCloser) Close() error
Close closes child Vim client process.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents Vim client.
func NewClient ¶
func NewClient(rw io.ReadWriter, handler Handler) *Client
NewClient creates Vim client.
Example (Job) ¶
package main import ( "os" vim "github.com/haya14busa/vim-go-client" ) type echoHandler struct{} func (h *echoHandler) Serve(cli *vim.Client, msg *vim.Message) { cli.Send(msg) } func main() { // see example/echo/ for working example. handler := &echoHandler{} cli := vim.NewClient(vim.NewReadWriter(os.Stdin, os.Stdout), handler) cli.Start() }
Output:
type Process ¶
type Process struct {
// contains filtered or unexported fields
}
Process represents Vim server process.
func NewChildVimServer ¶
NewChildVimServer creates Vim server process and connect to go-server by addr.