An emacs-inspired configuration of tmux.
hmux is an emacs-inspired configuration of tmux that also comes along with a few helpful bash functions to make tmux more accessible.
While tmux is not nearly as customizable as emacs, tmux does come with a surprising amount of customizable variables, hooks and bindings. The C-h help prefix key should come in handy for anyone who wants to play around with their tmux config.
If you use vim or another editor and want to setup an easy-to-use tmux configuration, hmux's .tmux.conf file should be good a starting place to begin switching over useful tmux bindings to your familiar keys.
git clone https://github.com/zhammer/hmux.git ~/.tmux.d ; ~/.tmux.d/install.sh should be all you need to install hmux and be able to pull from and push to github. This will clone hmux into ~/.tmux.d and create a symlink linking ~/.tmux.conf -> ~/.tmux.d/.tmux.conf. The install.sh script will rename any current ~/.tmux.conf file to ~/.tmux.conf.old.{timestamp} so you don't lose old configurations.
You can also just clone the hmux repo and hard copy hmux/.tmux.conf to ~/.tmux.conf if you don't want to setup ~/.tmux.d and the symlinking, though it'll be harder to pull in github updates and you won't have a centralized, easy-to-access tmux directory.
C-x-global prefix key- In
hmux, the defaulttmuxprefix key is switched fromC-btoC-xto match the prefix key ofemacs. - (This means that using
emacsin the shell requires an extraC-xto send the prefix key toemacs, though I dont know many people who useemacsin-nwmode)
- In
C-h-help prefix key- Prefix command for accessing information on active
tmuxkey bindings and environment variables as well astmuxman-page documentation. C-h-?for more info (experimental)
- Prefix command for accessing information on active
C-x 0delete current pane- Delete the current pane. Fails if there is only one pane in the current window.
C-x 1delete other panes in window- Delete all panes in the current window besides the active pane.
C-x 2split pane below- Split the current pane vertically so that the new pane below is in the current pane's directory.
C-x 3split pane right- Split the current pane horizontally so that the new pane to the right is in the current pane's directory.
C-x kkill pane (y/n)M-x AND M-:command promptC-x gmagit-lite- If inside a git repo, view the colorized git diff and status in a new window.
C-x rre-source ~/.tmux.conf fileM-[copy modeM-]paste bufferC-x M-(Up|Down|Left|Right)quick resizeM-topen new window in ~/.tmux.dC-b [0-9]switch to window[0-9]- (
hmux'semacsbindings overwrite some of the defaultC-x 0-9switch to window bindings)
- (
C-x schoose session- Open the list of active sessions in an interactive pane
- tmux command:
choose-tree -s
C-x zzoom pane- 'Zoom in' on the current pane, making it full screen until the
C-x zis entered again - tmux command:
resize-pane -Z
- 'Zoom in' on the current pane, making it full screen until the
Bash functions (tx.sh)
tx ls- List all sessions on the default tmux server (
tmux ls).
- List all sessions on the default tmux server (
tx {session_name}- If called from outside a tmux client:
- Attach to
{session_name}if it exists, otherwise create a new session called{session_name}and attach to it.
- Attach to
- If called from inside a tmux client:
- Switch to
{session_name}if it exists, otherwise print an error message.
- Switch to
- If called from outside a tmux client:
txk {session_name}- Kill
{session_name}.
- Kill
I read Brian Hogan's tmux 2 reference book in one afternoon at work after I'd spent a day juggling 5 shell windows to simultaneously start/stop a service, read its logs and run scripts on its data. The next day I was doing the same thing -- albeit a lot more easily -- in tmux. tmux 2 is a great book and a really quick read.
Overall, tmux is a great tool; the only major hurdle is the key bindings which are not always super convenient. Hopefully hmux can make that transition easier.