tmux manipulation from Emacs
Emacs Lisp Makefile
Latest commit 39f5778 Feb 27, 2017 @syohex syohex Merge pull request #47 from syohex/programmable-interface
Improve send-command API for using as a function

README.md

emamux.el melpa badge melpa stable badge

Interact with tmux from Emacs.

Screenshot

emamux_run_command

Introduction

emamux.el let emacs interact with tmux. emamux.el is inspired by tslime.vim and vimux.

Installation

emamux is available on MELPA and MELPA stable

You can install emamux with the following command.

M-x package-install [RET] emamux [RET]

Requirements

  • Emacs 24 or higher.
  • tmux 1.5

Basic Usage

emamux:send-command

Send command to specified target-session(session:window.pane).

Following is emamux:send-command demo with ido completion.

send-command-demo

target-session is set as default at first emamux:send-command called. You can change default target-session with C-u prefix.

emamux:yank-from-list-buffers

Yank from tmux buffer.

emamux:copy-kill-ring

Copy content of (car kill-ring) to tmux buffer

You can change buffer index with Numerical Prefix.

Following commands can be executed only within tmux

emamux:run-command

Run command in a small split pane(runner pane) where emacs is in.

emamux:run-last-command

Run last command in runner pane.

emamux:zoom-runner

Zoom runner runner pane. This command requires tmux 1.8 or higher.

emamux:inspect-runner

Move into the runner pane and enter the copy mode.

emamux:close-runner-pane

Close runner pane.

emamux:close-panes

Close all other panes in current window.

emamux:interrupt-runner

Interrupt command which is running in runner-pane.

emamux:clear-runner-history

Clear tmux history in runner-pane

Customize

emamux:completing-read-type

Completing read function type. You can choice from 'normal or 'ido, or 'helm.

emamux:default-orientation

Orientation of split pane, 'vertical or 'horizonal(Default is 'vertical).

emamux:runner-pane-height

Height of runner-pane(Default is 20).

emamux:use-nearest-pane

Use nearest pane as runner pane instead of splitting pane(Default is nil).

tmux configuration

It is useful for using emamux to show session name, window index and pane index in tmux status bar.

# '#S' is session name, '#I' is window index, '#P' is pane index
set-option -g status-right '[#h###S:#I:#P]'

Default keymap

emamux defines default keymap. You can use it by following configuration.

;; Bind keymap prefix to Ctrl-z
(global-set-key (kbd "C-z") emamux:keymap)

Default keymap is as below.

Key Command
Prefix C-s emamux:send-command
Prefix C-y emamux:yank-from-list-buffers
Prefix M-! emamux:run-command
Prefix M-r emamux:run-last-command
Prefix M-s emamux:run-region
Prefix C-i emamux:inspect-runner
Prefix C-k emamux:close-panes
Prefix C-c emamux:interrupt-runner
Prefix M-k emamux:clear-runner-history
Prefix c emamux:new-window
Prefix C emamux:clone-current-frame
Prefix 2 emamux:split-window
Prefix 3 emamux:split-window-horizontally

Sample configuration

(custom-set-variables
 '(emamux:completing-read-type 'helm))

Emamux Applications

See Also