# open a non-login shell, to avoid sourcing /etc/profile again set -g default-command "${SHELL}" # set prefix to C-s unbind-key C-b set -g prefix 'C-s' bind-key 'C-s' send-prefix # allow scrollback in Terminal set -g terminal-overrides 'xterm*:smcup@:rmcup@' # tell tmux that terminal has 256 colors set -g default-terminal "screen-256color" # keep 10k lines of scrollback set -g history-limit 100000 # refresh tmux config with prefix-R bind R source-file ~/.tmux.conf \; display-message "Config reloaded..." # window titles set -g set-titles on set-window-option -g automatic-rename on # disable escape sequence delay set -sg escape-time 0 # start window numbering at 1 set -g base-index 1 set -g pane-base-index 1 # resize whenever possible setw -g aggressive-resize on # new windows open in $CWD bind c new-window -c '#{pane_current_path}' # act like vim setw -g mode-keys vi bind-key | split-window -h bind-key - split-window 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 :+ # enter scrollback mode and scroll up on shift-pageup bind-key -n M-PPage copy-mode -u set-window-option -g xterm-keys on # to make ctrl-arrow, etc. work # status line inspired by wemux from https://gist.github.com/2305333 set -g status-left-length 32 set -g status-right-length 150 set -g status-style fg=white,bg=colour234 set -g window-status-activity-style bold set -g pane-border-style fg=colour245 set -g pane-active-border-style fg=colour39 set -g message-style fg=colour16,bg=colour221,bold set -g status-left "#[fg=colour235,bg=colour252,bold] #(scutil --get ComputerName) ⧉ #S #[fg=colour252,bg=colour235,nobold]" set -g window-status-format "#[fg=white,bg=colour234] #I #W" set -g window-status-current-format "#[fg=colour234,bg=colour39]#[fg=colour18,bg=colour39,noreverse,bold] #I  #W #[fg=colour39,bg=colour234,nobold]" set -g status-right " #[fg=colour238,bg=colour234]#[fg=white,bg=colour238,bold,noreverse] #{b:socket_path} " # Smart pane switching with awareness of Vim splits. # See: https://github.com/christoomey/vim-tmux-navigator # is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ # | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" # bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" # bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" # bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" # bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" # bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" # fix clipboard copying bind-key -T copy-mode-vi v send-keys -X begin-selection bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle # bind-key -T edit-mode-vi Up send-keys -X history-up # bind-key -T edit-mode-vi Down send-keys -X history-down set -g mouse on bind -n S-M-Up { copy-mode send -X clear-selection send -X start-of-line send -X start-of-line send -X cursor-up send -X start-of-line send -X start-of-line if -F "#{m:*❯ ?*,#{copy_cursor_line}}" { send -X search-forward-text "❯ " send -X stop-selection send -X -N 2 cursor-right send -X begin-selection send -X end-of-line send -X end-of-line if "#{m:*❯ ?*,#{copy_cursor_line}}" { send -X cursor-left } } { send -X end-of-line send -X end-of-line send -X begin-selection send -X search-backward-text "❯ " send -X end-of-line send -X end-of-line send -X cursor-right send -X stop-selection } }