This repository has been archived on 2024-03-28. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/sh/tmux.conf

122 lines
3.4 KiB
Plaintext
Raw Normal View History

2016-01-06 12:34:29 -06:00
# ^s as prefix
unbind C-b
set -g prefix C-s
bind-key s send-prefix
# statusbar on top
set-option -g status-position top
# better resizing
setw -g aggressive-resize on
set -s escape-time 1
# terminal
set -g default-terminal "screen-256color"
set-window-option -g utf8 on
set-window-option -g xterm-keys on
set-window-option -g mode-keys vi
set-window-option -g monitor-activity on
# status bar
set -g status-interval 5
set -g status-utf8 on
setw -g mode-bg black
set-option -g status-bg default
set-option -g status-fg default
set-option -g status-attr default
set-option -g message-bg default
set-option -g message-fg yellow
set -g status-left '#[fg=green]#(whoami)@#24h > #12S #[fg=default]| '
set -g status-left-length 64
set -g status-right '#[fg=blue]%b %d %H:%M'
set -g window-status-current-format '#[fg=blue]#I #W '
set -g window-status-format '#I #W '
set -g status
# splitting
bind-key v split-window -h
bind-key b split-window
bind-key H set status
# pane switching
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# pane resizing
bind-key -r M-k resize-pane -U 5
bind-key -r M-j resize-pane -D 5
bind-key -r M-h resize-pane -L 5
bind-key -r M-l resize-pane -R 5
bind-key -r C-k resize-pane -U
bind-key -r C-j resize-pane -D
bind-key -r C-h resize-pane -L
bind-key -r C-l resize-pane -R
# vim copying
setw -g mode-keys vi
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-selection
# Similar to 'C-w j' to navigate windows in Vim
unbind-key j
bind-key j select-pane -D
unbind-key k
bind-key k select-pane -U
unbind-key h
bind-key h select-pane -L
unbind-key l
bind-key l select-pane -R
# Enable mouse support (works in iTerm)
# set-window-option -g mode-mouse on
# set-option -g mouse-select-pane on
# set-option -g mouse-resize-pane on
set -g mouse on
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
# If we want Vim to be told about focus: http://git.io/2UqSgQ
set -g focus-events on
# Use tmux-resurrect to manage saving/restoring sessions
set -g @resurrect-save 'S'
set -g @resurrect-restore 'R'
2016-01-06 12:34:29 -06:00
# fix pbcopy/pbpaste
if 'command -v reattach-to-user-namespace >/dev/null' \
'set -gq @osx-pasteboard true'
if 'tmux show -gv @osx-clipboard' \
'set -g default-command "reattach-to-user-namespace -l $SHELL"'
# Copy top of tmux paste buffer stack to OS clipboard.
# Alternatively, this will always immediately copy to system pasteboard:
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
if 'tmux show -gv @osx-clipboard' \
'bind y run "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# present a menu of URLs to open from the visible pane. sweet.
bind-key u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlview /tmp/tmux-buffer"
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'