|
# Bind escape to copy mode
|
|
unbind [
|
|
bind v copy-mode
|
|
|
|
# p = paste
|
|
unbind p
|
|
bind p paste-buffer
|
|
|
|
# no escape delay
|
|
set -sg escape-time 0
|
|
|
|
# remap prefix to Control + a
|
|
set -g prefix C-a
|
|
unbind C-b
|
|
bind C-a send-prefix
|
|
|
|
# Start window numbering at 1 (default => 0)
|
|
set -g base-index 1
|
|
|
|
set -g clock-mode-style 12
|
|
|
|
# Renumber windows after removing one
|
|
set -g renumber-windows on
|
|
|
|
# Set the thumbs key to f, I don't use find-window anyways
|
|
unbind f
|
|
set -g @thumbs-key f
|
|
|
|
# use 256 colors
|
|
set -g default-terminal screen-256color
|
|
set-option -g default-shell /sbin/zsh
|
|
set -ag terminal-overrides ",xterm-256color:Tc"
|
|
|
|
# Keep plenty of history for scrollback
|
|
set -g history-limit 50000
|
|
|
|
# mouse
|
|
set -g mouse on
|
|
|
|
|
|
# Act like vim in copy mode
|
|
set -g status-keys vi
|
|
setw -g mode-keys vi
|
|
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
|
|
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
|
|
bind y run-shell "tmux show-buffer | xclip -sel clip -i" \; display-message "Copied tmux buffer to system clipboard"
|
|
|
|
# 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"
|
|
|
|
# Secondary binding for C-l to retain redraw
|
|
bind C-l send-keys 'C-l'
|
|
|
|
# Easy rotating of panes
|
|
bind C-k swap-pane -U
|
|
|
|
# increase display time
|
|
set -g display-panes-time 1200
|
|
|
|
# status bar stuff
|
|
set -g status-left-length 40
|
|
|
|
# Dismiss current pane to background window
|
|
bind b break-pane -d
|
|
bind-key j command-prompt -p "join pane from: " "join-pane -h -s '%%'"
|
|
|
|
# more intuitive keybindings for splitting
|
|
bind \\ split-window -h -c "#{pane_current_path}"
|
|
bind - split-window -v -c "#{pane_current_path}"
|
|
|
|
# Easy return to Vim from tmux runner zoom runner pane
|
|
bind C-p run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim$' && tmux send-keys ':VtrZoomRunnerPane' 'C-m') || tmux send-keys 'C-c' && tmux select-pane -l"
|
|
|
|
# Make C-j display a selectable list of sessions
|
|
bind C-j choose-tree
|
|
|
|
# Keep window names as I set them
|
|
setw -g automatic-rename off
|
|
|
|
# Reload tmux.conf with prefix-r
|
|
bind C-r source-file ~/.config/tmux/tmux.conf \; display "Reloaded ~/.config/tmux/tmux.conf"
|
|
|
|
# Provide access to the clipboard for pbpaste, pbcopy (details: http://goo.gl/DN82E)
|
|
set-window-option -g automatic-rename on
|
|
|
|
# Enable VI mode
|
|
set-window-option -g mode-keys vi
|
|
|
|
# Set ability to capture on start and restore on exit window data when running an application
|
|
setw -g alternate-screen on
|
|
|
|
# bind resizing of panes to H,J,K,L (resizes by steps of 10 lines/columns)
|
|
# # Note, bindings are repeatable (within the default 500ms time limit) so that
|
|
# # you don't have to keep entering the prefix. (Prefix-H-H-H resizes by 15)
|
|
bind -n S-Left resize-pane -L 2
|
|
bind -n S-Right resize-pane -R 2
|
|
bind -n S-Down resize-pane -D 1
|
|
bind -n S-Up resize-pane -U 1
|
|
unbind -n C-Left
|
|
unbind -n C-Down
|
|
unbind -n C-Up
|
|
unbind -n C-Right
|
|
bind -n C-Left resize-pane -L 10
|
|
bind -n C-Right resize-pane -R 10
|
|
bind -n C-Down resize-pane -D 5
|
|
bind -n C-Up resize-pane -U 5
|
|
|
|
unbind %
|
|
unbind '"'
|
|
# Split panes
|
|
bind | split-window -h -c "#{pane_current_path}"
|
|
bind _ split-window -v -c "#{pane_current_path}"
|
|
bind-key "\\" split-window -fh -c "#{pane_current_path}"
|
|
bind-key "_" split-window -fv -c "#{pane_current_path}"
|
|
|
|
# Disable status bar for weechat sessions
|
|
set-hook -g session-created 'if -F "#{==:#{session_name},weechat}" "set status off" "set status on"'
|
|
set-hook -g session-created 'if -F "#{==:#{session_name},weechat}" "set status off" "set status on"'
|
|
|
|
# Plugins
|
|
set -g @plugin 'tmux-plugins/tpm'
|
|
set -g @plugin 'tmux-plugins/tmux-sensible'
|
|
set -g @plugin 'tmux-plugins/tmux-resurrect'
|
|
set -g @plugin 'fcsonline/tmux-thumbs'
|
|
set -g @plugin 'wfxr/tmux-fzf-url'
|
|
set -g @plugin 'tmux-plugins/tmux-yank'
|
|
set -g @plugin 'wfxr/tmux-power'
|
|
set -g @plugin 'wfxr/tmux-web-reachable'
|
|
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
|
|
set -g @plugin 'wfxr/tmux-net-speed'
|
|
|
|
set -as terminal-overrides ',*:indn@' # This fixes the clear bug on tmate
|
|
|
|
# status bar theme
|
|
|
|
set -g status-bg 'colour235'
|
|
set -g status-justify 'centre'
|
|
set -g status-left-length '100'
|
|
set -g status 'on'
|
|
set -g status-right-length '100'
|
|
|
|
# Capture contents on tmux-ressurect save
|
|
set -g @resurrect-capture-pane-contents 'on'
|
|
|
|
# tmux-power config
|
|
set -g @tmux_power_theme 'sky'
|
|
set -g @tmux_power_show_upload_speed true
|
|
set -g @tmux_power_show_download_speed true
|
|
set -g @tmux_power_prefix_highlight_pos 'L'
|
|
set -g @tmux_power_show_web_reachable true
|
|
|
|
if "test ! -d ~/.local/share/tmux/plugins/tpm" \
|
|
"run 'git clone https://github.com/tmux-plugins/tpm ~/.local/share/tmux/plugins/tpm && ~/.local/share/tmux/plugins/tpm/bin/install_plugins'"
|
|
|
|
run -b '~/.local/share/tmux/plugins/tpm/tpm'
|
|
|