Last active
March 17, 2016 22:34
-
-
Save rosswd/be453060e2e09e0489da to your computer and use it in GitHub Desktop.
tmux setup, configuration and usage.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ############ # | |
# ~/.tmux.conf # | |
# ############ # | |
# Change prefix binding from C-b to C-a | |
unbind C-b | |
set -g prefix C-a | |
bind a send-prefix | |
# Reload .tmux.conf | |
unbind r | |
bind r source-file ~/.tmux.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy Mode - https://superuser.com/questions/395158/tmux-copy-mode-select-text-block | |
A way to scroll and copy text. | |
# Enable vi mappings in tmux (~/.tmux.conf) | |
setw -g mode-keys vi | |
C-a r # reload config | |
# Enter copy mode | |
C-a [ | |
# Exit copy mode | |
esc | |
# Move while in copy mode (i.e scrolling) | |
h j k l | |
up down left right | |
# Workflow: Copy a text block (assumes vi mappings are enabled for tmux, see above) | |
C-a, [ # enter copy mode | |
^ # goto start of line | |
C-v # vi select text | |
space # signify rectangle selection | |
h j k l # select text | |
enter # confirm selection (finish) | |
C-a, ] # paste from copy buffer | |
# you can either paste to command line or to a file in vim |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Install tmux via homebrew | |
brew update | |
brew info tmux | |
brew install tmux | |
# Example configs are available in: | |
/usr/local/Cellar/tmux/1.8/share/tmux/examples | |
# Install on Debian | |
sudo apt-get update; sudo apt-get install tmux; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ########## # | |
# tmux usage # | |
# ########## # | |
# Sources: | |
# http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/ | |
# http://www.mechanicalkeys.com/files/os/notes/tm.html | |
# http://linux.die.net/man/1/tmux and local man pages | |
# | |
# Using C- to represent control key because ^ occurs in some places. | |
# E.g. C-a is the binding key | |
# Misc. # | |
# ##### # | |
# Show all keybindings (q to exit) | |
C-b ? | |
# Enter fullscren | |
cmd+enter | |
# Sessions # | |
# ######## # | |
# List existing sessions | |
tmux list-sessions | |
# Start a new session | |
tmux | |
# Start a new session called irb_session | |
tmux new-session -s irb_session | |
irb --simple-prompt | |
# Detach from session | |
C-b d | |
# Re-attach to a detached session | |
tmux attach-session # last session or one only | |
tmux attach-session -t 3 # attach to session number 3 | |
tmux attach-session -t rails # attach to session called "rails" | |
tmux attach -t rails # alias version | |
# Rename an attached session | |
tmux rename-session -t 1 apache # rename session to "apache" | |
tmux rename -t 5 js # alias version | |
# Kill attached session | |
tmux kill-session -t 3 | |
# Windows # | |
# ####### # | |
# Create a new window (within tmux) | |
C-b c | |
# Move to previously selected window | |
C-b l | |
# Move to next window | |
C-b n | |
# Move to previous window | |
C-b p | |
# Move to window number (0-9) | |
# e.g. window 2 | |
C-b 2 | |
# List all windows | |
C-b w | |
# Find a window and go to it | |
# e.g. a window called irb | |
C-b f | |
irb | |
# List all windows using interactive mode | |
# interactive mode allows you to run any command tmux supports | |
C-b : | |
list-windows | |
# Select window (t=target) | |
# e.g. window 0 | |
C-b | |
select-window -t 0 | |
# Kill current window | |
C-b & | |
# Rename current window | |
C-b , | |
# Move window (window 0 to window 3) | |
C-b : | |
move-window -d -s 0 -t 3 | |
# Swap windows (swap window 3 to window 1) | |
# window 0 is gone because we detached it from where it | |
# was with -d. | |
C-b : | |
swap-window -d -s 3 -t 0 | |
# Splitting Panes # | |
# ############### # | |
# Windows broken into smaller windows | |
# | |
# Split window into two columns | |
C-b % | |
# Split window into two rows | |
C-b " | |
# Show pane numbers | |
# Enter number quick to go to window | |
C-b q | |
# Switch to next pane | |
C-b o | |
# Move current pane left | |
C-b { | |
# Move current pane right | |
C-b } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment