Skip to content

OliverMead/vterm-tmux

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 

Repository files navigation

vterm-tmux: Connect to TMux sessions anywhere.

Persistent terminals for your projects and general use.

An extension of multi-vterm.el, providing persistent terminal access through TMux (optionally over SSH using TRAMP).

Installation

This package is not yet in any packaging repositories, has not undergone any review except for my own purposes, and should be considered to be in a pre-release state.

Should you still wish to try it:

  • Install the dependencies.
  • Clone [this] repository
  • And either:
    • (load ...) the vterm-tmux.el file explicitly.
    • Or move/symlink vterm-tmux.el into your load path and (require 'vterm-tmux).

Dependencies

  • vterm
  • multi-vterm

Usage

This package provides one command:

  • vterm-tmux Attach to a tmux session. The raw prefix argument will indicate that the default-directory must be set before attaching to the session. This operation supports TRAMP paths.
  • vterm-tmux-project Attach to the current project’s tmux session. (project root is determined by (project-root (project-current)))

Configuration

This package may be customised through the following variables:

  • vterm-tmux-default-session The default name for a tmux session
  • vterm-tmux-default-hostname The default (host)name for local connections (this does not have to be valid on a network, it is only used for the buffer name)
  • vterm-tmux-connection-method The tmux command used to connect to the session
  • vterm-tmux-env A list of environment variables to explicitly pass to the shell
  • vterm-tmux-buffer-name-format Function of HOSTNAME and SESSION to return the string to be used as the buffer name for terminals created by this package.

Binding for vterm-tmux-project

This command’s default binding is <project-prefix> t, but is not bound by default. Call vterm-tmux-default-binding to bind it.

Hacks

Remote Sessions

Previously, this package would rely on some specific behaviour of vterm when running over TRAMP. At some point, this behaviour changed, such that attempting to run vterm-tmux with a remote default-directory would yield a regular vterm buffer, with no TMux running. Why? Because of a longstanding bug in TMux, which happened to be avoided by the older versions of vterm and TRAMP.

The Fix

This version of vterm-tmux unfortunately has to send the command to launch TMux to the terminal as if the user had typed it in. As a result, closing the remote terminal involves sending C-d C-d to first exit TMux, then exit the actual vterm session. I do not know if or when this change can be reverted to the desired behaviour of the vterm session closing with the TMux session.

Acknowledgements

  • Todd Goodall <tgoodall@utexas.edu>, for inspiration in the form of (the seemingly defunct) multi-term-tmux.el.
  • The good people at the Emacs IRC channel, for their encouragement.