dotfiles/a/tmux/.tmux.conf

65 lines
2.1 KiB
Plaintext
Raw Normal View History

2022-08-24 08:07:33 +00:00
# 256 colors for vim
set -g default-terminal "screen-256color"
# Set default shell to zsh
set-option -g default-shell /bin/zsh
# Tmuxline
if-shell "test -f ~/.tmuxline_snapshot.conf" "source ~/.tmuxline_snapshot.conf"
# Start window numbering at 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Cycle panes with C-b C-b
unbind ^B
bind ^B select-pane -t :.+
# Reload config wtih a key
bind-key r source-file ~/.tmux.conf \; display "Config reloaded!"
# Mouse works as expected
set -g mouse on
# set -g mode-mouse on
# set -g mouse-select-pane on
# set -g mouse-resize-pane on
# set -g mouse-select-window on
# Scrolling works as expected
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# Use the system clipboard
# set-option -g default-command "reattach-to-user-namespace -l zsh"
# Clear the pane and its history
bind -n C-k send-keys C-l \; clear-history
# Smart pane switching with awareness of vim splits
# From 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"
bind-key -T copy-mode-vi C-h select-pane -L
bind-key -T copy-mode-vi C-j select-pane -D
bind-key -T copy-mode-vi C-k select-pane -U
bind-key -T copy-mode-vi C-l select-pane -R
bind-key -T copy-mode-vi C-\\ select-pane -l
# C-l is taken over by vim style pane navigation (not sure where this comes from or whether I still need this)
bind C-l send-keys 'C-l'
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"