A basic session manager for tmux.
Latest versions of bash, coreutils and tmux.
Clone this repository:
$ git clone github.com/teegre/mux
Then:
$ cd mux
Finally:
# make install
# make uninstall
mux
Show list of existing sessions and exit.
mux <session>
Run the given tmux session.
mux new <session>
Create a new session.
mux edit <session>
Edit an existing session.
mux rm <session>
Remove a session.
mux mv <session> <new_session>
Rename a session.
mux version
Show version and exit.
mux help
Show help and exit.
Add the following lines to the .tmux.conf file:
set -g base-index 1
setw -g pane-base-index 1
set -g renumber-windows on
Also, make sure $EDITOR environment variable is set properly.
A session file is a plain text file that defines the configuration of a tmux session.
-
session-name: <name>- Defines the name of the
tmuxsession. - Example:
session-name: dev
- Defines the name of the
-
session-root: <path>- Sets the root directory for the session.
- Example:
session-root: ~/projects/myapp
Each window and pane is defined by a line with the following format:
<window_name> <pane_number> <command><window_name>: The name of the window.<pane_number>: The number of the pane within the window.<command>: The command to run in the specified pane.- Example:
mywindow 1 vim .
-
Splitting Panes:
v: Indicates a vertical split.h: Indicates a horizontal split.- Example:
mywindow 2v npm start(Creates a vertical split for pane2in windowmywindow.)
-
Active Pane:
*: Indicates that the pane should be active after the session starts.- Example:
mywindow 2* git status(Makes pane2in windowmywindowthe active pane.)
-
Setting Layout:
-
layout: Applies a specific layout to the window. -
Example:
mywindow layout main-horizontal(Sets the layout of window1tomain-horizontal.) -
For more complex layout, it is possible to paste the output of
tmuxlist-windows command. -
Example:
# Output of 'tmux list-windows -t test-session' # # 1: my-window* (3 panes) [239x57] [layout 8bbe,239x57,0,0{88x57,0,0,24,150x57,89,0[150x28,89,0,25,150x28,89,29,26]}] @15 (active) # file: test.mux session-name: test-session session-root: ~ my-window 1* clear; neofetch my-window 2 clear; neofetch my-window 3 clear; neofetch my-window layout 8bbe,239x57,0,0{88x57,0,0,24,150x57,89,0[150x28,89,0,25,150x28,89,29,26]}
-
- Lines starting with
#are comments and are ignored by mux.- Example:
# This is a comment
- Example: