As a power text-mode user, I was both surprised and glad to hear (10x @erikzaadi!) about two interesting tools: tmux & ConqueTerm, which significantly changed the way I use the shell/terminal. I'll try to keep it short and to the point, and briefly explain the most notable behavior-changing features the way I see them. Or in other words: why should you give them a try.
tmux
tmux is screen-like. I didn't get to learn much of screen (absolutely my bad), so it's really not a "why tmux is better than screen" post, but simply what goodies does tmux provide.
tmux goodies:
- Detach and reattach to the whole session. Even when X/ssh dies: this is basic, and that's what screen is most widely known for, but it's so important.
> list all sessions: tmux ls
> attach a certain session: tmux attach [-t <num>]
- Keep multiple copy-paste buffers. It'll stay there for as long as the session is alive. It'll not live through reboots, but will live multiple days through ssh logins, X crashes. When using multiple tmux sessions (e.g. I have one on each screen), all share the same copy-paste buffer. Bonus: no mouse involved 🙂
> Copy: Ctrl+B+[ . I find it much easier keyboard-wise with 'set -g mode-keys vi' in ~/.tmux.conf. So that I move with vim keys (0, $, b, B, w, W), Space starts selection, Enter finishes.
> Paste: Ctrl+B+]
> View clipboard buffers and choose what to paste: Ctrl+B+= (so cool!) - Keyboard controlled tabs ("windows") and window splits ("panes"). It's hard to explain its strength, but think of running some long running command - you want to see the output but in the meantime to run something else. Ctrl+B+^ will split the screen and provide bring a new shell above it. Much nicer than shell job control.
> Create panes: Ctrl+B+", Ctrl+B+% . Navigate: Ctrl+B+Arrow keys
> Create window: Ctrl+B+c . Navigate:Ctrl+B+(p/n/#)- Run command in a split: this one is very handy. Split dies when command dies.
> tmux split [-h] top
> tmux new-window tar -xvf /tmp/my.tar.gz
- Run command in a split: this one is very handy. Split dies when command dies.
- Scrollable, searchable, copyable, super-long buffer: basic, but well-made.
- Remote pair programming: it's a killer one. I know, screen has it too, but it's worth mentioning. The other peer, being logged in to the same host as the same user as you, simply needs to use 'tmux attach' to attach to the specific session.
- tmuxinator: I didn't yet make good use of it, but it certainly redefines the meaning of "cool".
You can check out my tmux.conf, and this ssh-agent-restore helper.
ConqueTerm - a console buffer inside vim
I never got to play well with Emacs. But I must admit it's strong. One of the features I got excited about was that anything is a buffer, either a text file or a console. And since seeing it, I was looking for a vim equivalent. And just when I gave up, ConqueTerm appeared.
ConqueTerm goodies:
- Output is a vim buffer: it's fun using the familiar vim tools on your output: search, navigate, select and copy, % for brace matching, etc.
- Copy-and-paste between a regular edited file and the terminal buffer in both directions.
- Brace matching on command line: running a complex command line with all sorts of braces? a well-configured VIM would highlight the matching brace when cursor is over it.
- Keyboard-controlled window sizing and position: create the terminal buffer as a vertical split, resize, etc.
> Also possible to modify after creation: I found Ctrl+W+J (capital J) pretty useful, as well as the other H,K,L vim navigation keyskeys). It changes the window layout by saying "current window stays on bottom and uses all of it.
Hey Oren,
Nice post!. Two things that made my life easier in tmux:
1) Rebind default prefix key to Ctrl-a:
set -g prefix C-a
unbind C-b
bind C-a send-prefix
2) And dump x clipboard to tmux paste buffer and dump tmux copy buffer into x clipboard:
bind C-p run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
bind C-y run "tmux show-buffer | xclip -selection clipboard"
@pablo - Nice!
I got very used to ^B as I shamefully didn't get used to screen. The x clipboard thing looks so useful! applying immediately 🙂