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/shell/tmux/tmux.conf
Daniel Flanagan 40f78e442c Updates
2019-08-06 12:33:23 -05:00

142 lines
3.6 KiB
Plaintext

# ^s as prefix
unbind C-b
set -g prefix C-s
bind-key s send-prefix
bind-key T source-file ~/.tmux.conf \; display-message "source-file done"
# set-option -g mouse on
# honestly not sure
set -g escape-time 10
set-window-option -g monitor-activity on
bind-key W resize-pane -x 100
# splitting
bind-key v split-window -h
bind-key b split-window
set -g default-terminal "tmux-256color"
# iterating
unbind r
bind r source-file ~/.tmux.conf
# show tmux status bar by default (prefix H toggles)
set -g status on
bind-key H set -g status
bind-key j switch-client -p
bind-key h switch-client -p
bind-key k switch-client -n
bind-key l switch-client -n
bind-key P attach-session -t . -c '#{pane_current_path}'
# bind-key T set-option -g mouse off
# bind-key G set-option -g mouse on
# message colors
# set -g message-bg colour0
# set -g message-fg colour7
# status bar configuration
set-option -g status-position bottom
# set -g status-utf8 on
# set -g status-justify right
# status bar colors
set -g status-bg colour0
set -g status-fg colour8
# setw -g window-status-current-fg colour7
# setw -g window-status-current-bg colour2
# setw -g window-status-current-attr bold
set-window-option -g window-status-current-format ''
set -g status-interval 5
set -g status-right-length 80
set -g status-right "#[fg=colour4]#W#[fg=default]#[bg=default] #H"
set -g status-left-length 200
set -g status-left "#[fg=colour7]#(~/.config/dotfiles/scripts/bin/tmux-session-list #S)"
# vim copying
set-window-option -g mode-keys vi
# 1-based indexing for keystroke simplicity
set -g base-index 1
set -g pane-base-index 1
# custom predefined layouts
bind M-l source-file ~/.tmux/layouts/dev.tmux
# set -g pane-border-fg colour18
# set -g pane-active-border-fg blue
# set -g pane-active-border-bg default
bind-key s run "tmux new-window 'sh -ci tmuxswitcher'"
# present a menu of urls to open from the visible pane
bind-key u capture-pane \;\
save-buffer /tmp/tmux-buffer \;\
split-window -l 10 "urlview /tmp/tmux-buffer"
# mimic pane switching in and out of vim
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"
bind-key -Tcopy-mode-vi 'C-h' send -X "cancel select-pane -L"
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
# list of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# prefix+[ for select mode
# v for visual mode
# yank to clipboard with y
# paste with prefix+]
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'christoomey/vim-tmux-navigator'
# plugin options
# enable continuum
set -g @continuum-restore 'on'
# let continuum startup on boot
set -g @continuum-boot 'on'
set -g @resurrect-save 'C-v'
# unbind C-s
set -g @resurrect-restore 'R'
# initialize tmux plugin manager
run '~/.tmux/plugins/tpm/tpm'
bind -T root F12 \
set prefix None \;\
set key-table off \;\
set status off \
if -F '#{pane_in_mode}' 'send-keys -X cancel' \;\
refresh-client -S \;\
bind -T off F12 \
set -u prefix \;\
set -u key-table \;\
set status on \;\
refresh-client -S
unbind-key C-p