mirror of
https://github.com/jbowdre/dotfiles.git
synced 2024-11-24 10:12:17 +00:00
115 lines
3.7 KiB
Bash
115 lines
3.7 KiB
Bash
####################################
|
|
## BINDINGS ##
|
|
####################################
|
|
|
|
# Change default Prefix key to Ctrl+Space unless this is an SSH session
|
|
if-shell -b '! [ "$SSH_CLIENT" ]' {
|
|
unbind C-b; set -g prefix C-Space; display 'Bind key: CTRL+SPACE'
|
|
}
|
|
|
|
# Reload config with Prefix+R
|
|
unbind r
|
|
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
|
|
|
|
# mouse mode
|
|
set -g mouse on
|
|
bind m set -g mouse on \; display 'Mouse: ON'
|
|
bind M set -g mouse off \; display 'Mouse: OFF'
|
|
|
|
# Increase history limit
|
|
set -g history-limit 100000
|
|
|
|
# shorter escape time
|
|
set -sg escape-time 20
|
|
set -sg repeat-time 600
|
|
|
|
# Copy Mode (Prefix+[)
|
|
set-window-option -g mode-keys vi # Vim keys to navigate (Ctrl+u, Ctrl+d, /)
|
|
unbind -T copy-mode-vi Space; # Begin-selection
|
|
unbind -T copy-mode-vi Enter; # Copy-selection
|
|
bind -T copy-mode-vi v send-keys -X begin-selection # select text with 'v'
|
|
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel --clipboard" # copy text with 'y'
|
|
|
|
## Vim integrations
|
|
# 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 -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"
|
|
|
|
## PANES
|
|
# Split panes with v and h
|
|
unbind v
|
|
unbind h
|
|
unbind % # Split vertically
|
|
unbind '"' # Split horizontally
|
|
bind v split-window -h -c "#{pane_current_path}"
|
|
bind h split-window -v -c "#{pane_current_path}"
|
|
|
|
# Navigating panes with Ctrl+{hjkl}
|
|
bind -n C-h select-pane -L
|
|
bind -n C-j select-pane -D
|
|
bind -n C-k select-pane -U
|
|
bind -n C-l select-pane -R
|
|
|
|
# pane resize with left/right/up/down
|
|
bind -r Left resize-pane -L 5
|
|
bind -r Right resize-pane -R 5
|
|
bind -r Up resize-pane -U 5
|
|
bind -r Down resize-pane -D 5
|
|
|
|
# swap panes with <>
|
|
bind > swap-pane -D
|
|
bind < swap-pane -U
|
|
|
|
# synchronize panes with S
|
|
bind S set-window-option synchronize-panes \; display-message 'Synchronize-panes #{?pane_synchronized,on,off}'
|
|
|
|
## WINDOWS
|
|
# Windows start at 1 not 0
|
|
set -g base-index 1
|
|
set-window-option -g pane-base-index 1
|
|
|
|
# Window operations
|
|
unbind n # Move to next window
|
|
unbind w # Change current window interactively
|
|
bind n command-prompt "rename-window '%%'"
|
|
bind w new-window -c "#{pane_current_path}"
|
|
bind -n M-j previous-window # Alt+j
|
|
bind -n M-k next-window # Alt+k
|
|
|
|
####################################
|
|
## DESIGN ##
|
|
####################################
|
|
|
|
# default statusbar colors
|
|
set-option -g status-style fg=yellow,bg=black
|
|
|
|
# default window title colors
|
|
set-window-option -g window-status-style fg=brightblue,bg=default
|
|
# set-window-option -g window-status-style dim
|
|
|
|
# active window title colors
|
|
set-window-option -g window-status-current-style fg=brightred,bg=default
|
|
#set-window-option -g window-status-current-style bright
|
|
|
|
# pane border
|
|
set-option -g pane-border-style fg=black
|
|
set-option -g pane-active-border-style fg=brightgreen
|
|
|
|
# message text
|
|
set-option -g message-style fg=brightred,bg=black
|
|
|
|
# pane number display
|
|
set-option -g display-panes-active-colour blue
|
|
set-option -g display-panes-colour brightred
|
|
|
|
# clock
|
|
set-window-option -g clock-mode-colour brightgreen
|
|
|
|
# bell
|
|
set-window-option -g window-status-bell-style fg=black,bg=red
|