Created
October 17, 2023 17:13
-
-
Save stickperson/cb12f8e7db755b27b011e15e35d95ead to your computer and use it in GitHub Desktop.
tmux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# correct colors | |
set -g default-terminal "screen-256color" | |
# allow mouse scrolling. Hold option to temporarily disable. | |
set -g mouse on | |
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'" | |
bind -n WheelDownPane select-pane -t= \; send-keys -M | |
# Set prefix to control+a | |
set -g prefix C-a | |
unbind C-b | |
# send-prefix sends command to inner session. | |
# Without -n, you need to use the prefix | |
# see http://stackoverflow.com/questions/17920947/how-to-pass-command-keys-to-a-remote-tmux-session-when-you-ssh-from-a-local-tmux | |
bind-key -n C-q send-prefix | |
# Send same command to all panes | |
bind e setw synchronize-panes | |
# Grabs the pane from the target window and joins it to the current | |
bind-key j command-prompt -p "join pane from:" "join-pane -s '%%'" | |
bind-key k command-prompt -p "send pane to:" "join-pane -t '%%'" | |
# Copy/paste | |
set-option -g default-command "reattach-to-user-namespace -l zsh" | |
## START COPY | |
# vi 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" | |
bind -Tcopy-mode-vi v send -X begin-selection | |
bind -Tcopy-mode-vi y send -X copy-pipe "reattach-to-user-namespace pbcopy" | |
# Update default binding of `Enter` to also use copy-pipe | |
unbind -Tcopy-mode-vi Enter | |
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy" | |
bind -Tcopy-mode-vi Enter send -X copy-pipe "reattach-to-user-namespace pbcopy" | |
# Unbind from non-macOS setup | |
### END COPY | |
# set window and pane index to 1 (0 by default) | |
set-option -g base-index 1 | |
setw -g pane-base-index 1 | |
# set scroll history | |
set-option -g history-limit 10000 | |
# reload ~/.tmux.conf using PREFIX r | |
bind r source-file ~/.tmux.conf \; display "Reloaded!" | |
# ---------------------- | |
# set some pretty colors | |
# ---------------------- | |
set -g pane-border-status off | |
set -g pane-border-format "[#[fg=default]#{?pane_active,#[fg=cyan#,bold],} #T #[fg=default,nobold]]" | |
set -g pane-border-style fg=default | |
set -g pane-active-border-style fg=default,bold | |
bind-key t command-prompt -p "rename pane:" "select-pane -T '%%'" | |
bind-key y command-prompt -p "set pane border to top:" "set pane-border-status top" | |
# use PREFIX | to split window horizontally and PREFIX - to split vertically | |
bind | split-window -h -c "#{pane_current_path}" | |
bind - split-window -v -c "#{pane_current_path}" | |
bind c new-window -c "#{pane_current_path}" | |
# ---------------------- | |
# Status Bar | |
# ----------------------- | |
set-option -g status on # turn the status bar on | |
set -g status-interval 15 # set update frequencey (default 15 seconds) | |
set -g status-justify centre # center window list for clarity | |
# visual notification of activity in other windows | |
setw -g monitor-activity on | |
set -g visual-activity on | |
set -g status-style bg=default | |
set -g window-status-activity-style bg=yellow,noreverse | |
set -g window-status-format "#[fg=colour124,bg=default] #[fg=colour244]#W" | |
set -g window-status-current-format "#[fg=colour34] #[fg=colour7]#W" | |
# Show the session name | |
set -g status-left-length 20 | |
set -g status-left "#[fg=colour80]#S" | |
set -g status-right-length 60 | |
set -g status-right "#[fg=yellow]%b %d, %Y #[fg=white]:: %l:%M %p ::#[fg=red] #S #I:#P" | |
# ---------------------- | |
# End Status Bar | |
# ----------------------- | |
# don't rename windows automatically | |
set-option -g allow-rename off | |
# Force tmux to start a non-login shell. Doing so prevents tmux from messing up the $PATH | |
set -g default-command $SHELL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment