diff --git a/install/tmux b/install/tmux new file mode 100644 index 00000000..db4137d6 --- /dev/null +++ b/install/tmux @@ -0,0 +1,21 @@ +#!/bin/bash + +echo "[TMUX]" +if [ ! `command -v "brew"` ]; then + echo "Requires homebrew" + exit +fi + +echo +if [ ! `command -v "tmux"` ]; then + echo "* Installing tmux & reattach-to-user-namespace" + brew install tmux reattach-to-user-namespace +else + echo "* Tmux is already installed!" +fi + +echo +echo "* Setting up symlinks" +src=$(cd "$(dirname "$0")"; pwd) + +ln -sf $src/tmux.conf ~/.tmux.conf diff --git a/tmux.conf b/tmux.conf new file mode 100644 index 00000000..496e640b --- /dev/null +++ b/tmux.conf @@ -0,0 +1,42 @@ +# go zsh, go +set-option -g default-shell $SHELL + +# set utf-8 +set-window-option -g utf8 on +set -g status-utf8 on + +# look good +set-option -g default-terminal "screen-256color" + +# act like GNU screen +unbind C-b +set -g prefix C-a + +# set vi bind +set-window-option -g mode-keys vi + +# share clipboard +set-option -g default-command "/usr/local/bin/reattach-to-user-namespace -l $SHELL" + +# a mouse +set -g mode-mouse on +setw -g mouse-select-window on +setw -g mouse-select-pane on + +# act like vim +setw -g mode-keys vi +bind h select-pane -L +bind j select-pane -D +bind k select-pane -U +bind l select-pane -R +bind-key -r C-h select-window -t :- +bind-key -r C-l select-window -t :+ +unbind [ +bind ` copy-mode +unbind p +bind p paste-buffer +bind -t vi-copy v begin-selection +bind -t vi-copy y copy-selection + +# after copying to a tmux buffer, hit y again to copy to clipboard +bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"