See this article http://robots.thoughtbot.com/post/55885045171/tmux-copy-paste-on-os-x-a-better-future
brew install tmux (needs 1.8) brew install reattach-to-user-namespace
| # Set prefix key | |
| set -g prefix C-a | |
| unbind C-b | |
| # Send prefix | |
| bind C-a send-prefix | |
| # Reload key | |
| bind R source-file ~/.tmux.conf \; display "Reloaded!" | |
| # use 256 term for pretty colors | |
| set -g default-terminal "screen-256color" | |
| # increase scroll-back history | |
| set -g history-limit 5000 | |
| # use vim key bindings | |
| setw -g mode-keys vi | |
| set-window-option -g mode-keys vi | |
| # decrease command delay (increases vim responsiveness) | |
| set -sg escape-time 1 | |
| # increase repeat time for repeatable commands | |
| set -g repeat-time 1000 | |
| # start window index at 1 | |
| set -g base-index 1 | |
| # start pane index at 1 | |
| setw -g pane-base-index 1 | |
| # re-number windows when one is closed | |
| set -g renumber-windows on | |
| # Splitting panels | |
| bind v split-window -h | |
| bind s split-window -v | |
| # Remapping Movement Keys like vi | |
| bind h select-pane -L | |
| bind j select-pane -D | |
| bind k select-pane -U | |
| bind l select-pane -R | |
| # cycle windows | |
| bind -r C-h select-window -t :- | |
| bind -r C-l select-window -t :+ | |
| # Resizing panels | |
| bind H resize-pane -L 5 | |
| bind J resize-pane -D 5 | |
| bind K resize-pane -U 5 | |
| bind L resize-pane -R 5 | |
| # No mouse. Sticky with the keyboard | |
| setw -g mode-mouse off | |
| set -g mouse-select-pane off | |
| set -g mouse-resize-pane off | |
| set -g mouse-select-window off | |
| # copy and paste | |
| unbind [ | |
| bind Escape copy-mode | |
| unbind p | |
| bind p paste-buffer | |
| # Setup 'v' to begin selection as in Vim | |
| bind-key -t vi-copy v begin-selection | |
| # bind-key -t vi-copy 'y' copy-selection | |
| bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" | |
| # Update default binding of `Enter` to also use copy-pipe | |
| unbind -t vi-copy Enter | |
| bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | |
| set -g default-command "reattach-to-user-namespace -l /bin/bash" | |
| bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy" | |
| bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer" | |
| # # come back to the last window | |
| # bind-key C-a last-window | |
| # | |
| # | |
| # # Set status bar | |
| # set -g status-bg black | |
| # set -g status-fg white | |
| # set -g status-left ‘#[fg=green]#H’ | |
| # | |
| ########################### | |
| # Status Bar | |
| ########################### | |
| # enable UTF-8 support in status bar | |
| set -g status-utf8 on | |
| # set refresh interval for status bar | |
| set -g status-interval 60 | |
| # highlight window when it has new activity | |
| setw -g monitor-activity on | |
| set -g visual-activity on | |
| # status bar colors | |
| set -g status-fg white | |
| set -g status-bg black | |
| # windows list | |
| setw -g window-status-fg cyan | |
| setw -g window-status-bg default | |
| setw -g window-status-attr dim | |
| setw -g window-status-current-fg white | |
| setw -g window-status-current-bg red | |
| setw -g window-status-current-attr bright | |
| set -g pane-border-fg green | |
| set -g pane-border-bg black | |
| #set -g pane-active-border-fg white | |
| #set -g pane-active-border-bg yellow | |
| # command line | |
| set -g message-fg white | |
| set -g message-bg black | |
| set -g message-attr bright | |
| # Maximize and restore a pane | |
| unbind Up | |
| bind Up new-window -d -n tmp \; swap-pane -s tmp.1 \; select-window -t tmp | |
| unbind Down | |
| bind Down last-window \; swap-pane -s tmp.1 \; kill-window -t tmp | |
| # Rotate window | |
| bind r rotate-window |
See this article http://robots.thoughtbot.com/post/55885045171/tmux-copy-paste-on-os-x-a-better-future
brew install tmux (needs 1.8) brew install reattach-to-user-namespace