nmux

package module
v0.0.0-...-048a811 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

README

nmux

nmux is a multiplexer for Neovim processes. It is very much a work in progress at the moment.

It currently has a built-in HTTP server that renders a single nvim process in your browser using websockets as a proof-of-concept. Short video of nvim rendered in a browser: https://youtu.be/mzfHBPHkT-E

The browser client was made mainly for prototyping. Native GUI clients for Linux, macOS, and Windows are being worked on.

Requirements

Neovim must be installed and nvim available in $PATH.

Install

There is an unstable Darwin (macOS) binary available. Windows and Linux builds will be available in the future.

You can also install it with Go:

$ go get -u github.com/tweekmonster/nmux/cmd/nmux

Usage

To run the server:

$ nmux --server --addr localhost:9999

To use Neovim in a browser, go to http://localhost:9999/

Note: The browser client has been tested and works in Google Chrome. The keyboard currently doesn't work in Firefox or Safari. If you're using an extension that gives you vi functionality, it will need to be disabled.

If you're using the Darwin release:

$ nmux.app/Contents/MacOS/nmux --server --addr localhost:9999

Then run nmux.app to connect to the server. If you're using a port other than 9999, you will need to run the client the same way, but without the --server flag. A future release will allow you to configure a remote server and optionally spawn a local server.

Goals

  • A server that manages multiple nvim processes.
    • Allow clients to connect over TCP.
    • Shared unnamed register between all nvim processes.
  • Native cross-platform client programs.
    • Each nvim instance can be a tab or a split view.
    • UI is always consistent. No platform-specific GUI elements, except for the title bar.
    • Image replacements for glyphs (in-editor icons).
    • Basic OS integration (clipboard, notifications, open URLs, etc.)
  • "Simplified" configuration.
    • Only basics need to be configured for client programs.
      • Client programs can be scripted and configured via vimscript.
    • No need to configure a terminal emulator or tmux. nvim can already be configured and scripted to no end.

The ultimate goal is to create native client apps that connect to the nmux server, making the terminal emulator an obsolete program in my daily work. This is not an attempt to create a new terminal emulator—nvim already has reliable terminal emulator built-in through libvterm.

This will make it possible to turn a Docker container or Virtual Machine (possibly even WSL) into your "IDE". You could take a snapshot of your workspaces and resume where you left off after a reboot.

Documentation

Index

Constants

View Source
const (
	MsgRequest = 0
	MsgReply
	MsgNotification
)

Variables

View Source
var ErrEmpty = errors.New("empty")
View Source
var ErrFirstArgString = errors.New("first item must be a string")

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func MustAsset

func MustAsset(name string) []byte

MustAsset is like Asset but panics when Asset would return an error. It simplifies safe initialization of global variables.

func RestoreAsset

func RestoreAsset(dir, name string) error

RestoreAsset restores an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

RestoreAssets restores an asset under the given directory recursively

func WebServer

func WebServer(addr string) (io.Closer, error)

Types

type Process

type Process struct {
	*screen.Screen
	ID      int
	Deadman <-chan int
	// contains filtered or unexported fields
}

func NewProcess

func NewProcess(cwd string, width, height int) (*Process, error)

func (*Process) Attach

func (p *Process) Attach(w io.Writer) error

func (*Process) Detach

func (p *Process) Detach() error

func (*Process) Input

func (p *Process) Input(keys string) (int, error)

func (*Process) IsRunning

func (p *Process) IsRunning() bool

func (*Process) Resize

func (p *Process) Resize(w, h int) error

type WebsocketWriter

type WebsocketWriter struct {
	Conn *websocket.Conn
}

func (WebsocketWriter) Write

func (w WebsocketWriter) Write(p []byte) (int, error)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL