nmux

package module
v0.0.0-...-799c34b Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2019 License: Apache-2.0 Imports: 14 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/kraust/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 WebServer

func WebServer(addr string, dir 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