introduction to tmux - codementor tmux office hours part 1

Post on 15-Jun-2015

2.433 Views

Category:

Technology

5 Downloads

Preview:

Click to see full reader

DESCRIPTION

What is tmux? tmux is a terminal multiplexer: it enables a number of terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single screen. It is a popular secret weapon of many experienced developers. Codementor expert Bruno Sutic is the creator of various Tmux plugins. In this Office Hours Bruno will talk about beginning with tmux, but also about more advanced use cases and best practices. Here's a list of topics Bruno will cover: why use tmux tmux basics best practices tmux plugin manager - 'TPM' tmux-resurrect - why use it tmux-copycat + tmux-yank + tmux-open (how to work with these plugins)

TRANSCRIPT

Starting Tmux

Problem with the vanilla console app?

• managing (huge) number of terminals

• example terminals for just one project

Problem with the vanilla console app?

• example terminals multiple projects

Solution?Tmux - terminal multiplexer

• “Core” features:

• multiple windows

• window splits (horizontal & vertical)

• sessions (groups of windows)

• persistant env

• Other advanced features

Installing Tmux

• Mac$ brew install tmux$ brew install reattach-to-user-namespace (fixes pbpaste)

• Linux$ apt-get install -y tmux

Recommended configuration• ~/.tmux.conf - tmux config file

• remap default “prefix” from Ctrl-b to Ctrl-a

• set -g prefix C-a # in .tmux.conf

• remap Caps Lock to Ctrl (on a system level)

Demo: starting tmux

• just type $ tmux

Demo: creating new windows

• prefix + c

Demo: navigating windows

• previous window: prefix + p • next window: prefix + n • specific window: prefix + <num>

Demo: splitting windows

• vertical split: prefix + % • horizontal split: prefix + “

*unusual choiceof keys

Demo: split movement

• prefix + <arrow key>

Demo: creating sessions

• prefix + :new -s session_name *veryinconvenient

Demo: switching sessions

• switch session: prefix + s • navigate sessions: j, k (or arrow keys)

Demo: detaching tmux

• detach: prefix + d • attach: $ tmux attach

Tmux demo roundup• manipulating windows

• manipulating splits

• manipulating sessions

• some quirky defaults => Tmux configuration

Basic Tmux configuration• very configurable

• any key-binding can be changed

• “community standards” - things everyone has in their .tmux.conf

Configuration via plugins• tmux-sensible

- handles tmux quirks and boilerplate configuration

• tmux-pain-control- convenient basic key bindings

• tmux-sessionist- better session handling

Installing plugins

Plugin benefits

• less tmux quirks • more vim :)

Next steps?• look up tmux copy mode (scrollback)

• $ man tmux

• use tmux daily

• tmux book

• more pluginshttps://github.com/tmux-plugins

Questions?

top related