Files
dotfiles/tmux/.tmux.conf
Christian Nieves b78fa468a5 Swap window tmux
2023-05-10 12:06:28 -05:00

150 lines
4.8 KiB
Bash

unbind C-b
set-option -g update-environment "SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set -g prefix C-a
bind C-a send-prefix
set -g mouse off
set -g prefix `
bind-key ` send-prefix
# Hide pane with Prefix-h
bind-key h break-pane -d -n _hidden_pane
bind-key H join-pane -s $.1
# Tick -> Ctrl-A, sets prefix to Ctrl-A
bind-key C-a set-option -g prefix C-a
# Ctrl-A -> Ctrl-b, sets prefix to Tick
bind-key C-b set-option -g prefix `
set-option -g history-limit 100000000
set-option -g status-position bottom
set-option -g bell-action other
set-option -g visual-bell on
set -g base-index 1
set -g pane-base-index 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# enable OSC 52 clipboard
set -as terminal-overrides ',tmux*:Ms=\\E]52;%p1%s;%p2%s\\007'
set -as terminal-overrides ',screen*:Ms=\\E]52;%p1%s;%p2%s\\007'
set -s set-clipboard on
set -g @thumbs-osc52 '1'
# tmux-256color instead of screen-256color enables italics
set -g default-terminal "tmux-256color"
# Tc enables true color
set -ag terminal-overrides ",*256col*:colors=256:Tc"
set -as terminal-features ',rxvt-unicode-256color:clipboard'
set -g allow-passthrough on
# set -g default-shell zsh
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
bind -n C-b send-keys -R \; clear-history \; send-keys C-l
set -g status on
set-option -g status-interval 2
bind Escape confirm-before "kill-server"
# Automatically set window title
set-window-option -g automatic-rename off
set-window-option -g allow-rename on
#set-option -g set-titles on
set-window-option -g xterm-keys on
set-option -g xterm-keys on
set -g status-keys vi
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
# transfer copied text to attached terminal with yank
bind-key -T copy-mode-vi y send-keys -X copy-pipe 'yank > #{pane_tty}'
# transfer copied text to attached terminal with yank
bind-key -T copy-mode-vi Y send-keys -X copy-pipe 'yank > #{pane_tty}'
# transfer most-recently copied text to attached terminal with yank
bind-key -n M-y run-shell 'tmux save-buffer - | yank > #{pane_tty}'
# transfer previously copied text (chosen from a menu) to attached terminal
bind-key -n M-Y choose-buffer 'run-shell "tmux save-buffer -b \"%%%\" - | yank > #{pane_tty}"'
# Bind ']' to use pbpaste
#bind ] run "pbpaste | tmux load-buffer - && tmux paste-buffer"
setw -g monitor-activity on
bind-key v split-window -h -c '#{pane_current_path}'
bind-key s split-window -v -c '#{pane_current_path}'
bind -n M-s set-window-option synchronize-panes\; display-message "synchronize-panes is now #{?pane_synchronized,on,off}"
bind -n M-z resize-pane -Z
bind -n M-j resize-pane -D 5
bind -n M-k resize-pane -U 5
bind -n M-h resize-pane -L 5
bind -n M-l resize-pane -R 5
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
# allowd pane-navigation while in copy-mode
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
# Shift arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# Ctrl-Shift arrow to swap windows
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# swap window to left or right
bind-key -r < swap-window -t -1\; select-window -t -1
bind-key -r > swap-window -t +1\; select-window -t +1
# loop through current window's panes while zoomed
bind -r "'" select-pane -t .+1 \; resize-pane -Z
bind -r ";" select-pane -t .-1 \; resize-pane -Z
bind-key C-a set-option -g prefix C-a
# No delay for escape key press
set -sg escape-time 0
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'christoomey/vim-tmux-navigator'
set -g @plugin 'tmux-plugins/tmux-cpu'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-cowboy' # Kill process in pane w/ prefix+*
set -g @plugin 'catppuccin/tmux'
#set -g @plugin 'odedlaz/tmux-onedark-theme'
set -g @catppuccin_flavour 'macchiato' # or frappe, macchiato, mocha
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'