Skip to content

Instantly share code, notes, and snippets.

@jonjitsu
Created November 3, 2023 14:07
Show Gist options
  • Save jonjitsu/5a661631caeb35213ec4871c28ffa303 to your computer and use it in GitHub Desktop.
Save jonjitsu/5a661631caeb35213ec4871c28ffa303 to your computer and use it in GitHub Desktop.
.tmux.conf
#
# Works with:
# tmux-2.3
#
unbind-key -a
unbind C-b
set -g prefix C-j
set -g default-terminal "xterm-256color"
# Set status bar
set -g status-style bg=black,fg=white
set -g status-left '#[fg=green]#H'
set -g status-right '#[fg=yellow]#S'
#set -g status-right '#[fg=yellow]#(uptime | cut -d "," -f 2-)'
set-option -g allow-rename off
# scrollback buffer size
set-option -g history-limit 10000
# active window title colors
# set-window-option -g window-status-current-style bg=black,bright
set-window-option -g window-status-current-style fg=colour166 #orange
#set-window-option -g window-status-current-attr bright
set -g window-style 'fg=#555555,bg=#000000'
set -g window-active-style 'fg=#ffffff,bg=#000000'
bind-key r select-pane -t: -P 'bg=#700000'
bind-key R select-pane -t: -P 'bg=#000000'
bind-key : command-prompt
bind-key Space next-layout
bind-key , command-prompt "rename-window '%%'"
bind-key C-j copy-mode -e
bind-key C-s split-window -v
bind-key C-v split-window -h
bind-key C-k kill-pane
bind-key C-n new-window
#bind-key C-w kill-window
#bind-key C-o select-pane -t :.+
bind-key o rotate-window -D
bind-key 0 select-window -t :0
bind-key 1 select-window -t :1
bind-key 2 select-window -t :2
bind-key 3 select-window -t :3
bind-key 4 select-window -t :4
bind-key 5 select-window -t :5
bind-key 6 select-window -t :6
bind-key 7 select-window -t :7
bind-key 8 select-window -t :8
bind-key 9 select-window -t :9
bind-key -r H resize-pane -L 1
bind-key -r L resize-pane -R 1
bind-key -r K resize-pane -U 1
bind-key -r J resize-pane -D 1
bind -n M-C-h previous-window
bind -n M-C-l next-window
# klunky
bind -r h select-pane -L
bind -r l select-pane -R
bind -r k select-pane -U
bind -r j select-pane -D
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
# Default shell
# set-option -g default-shell /usr/local/bin/xonsh
# set-option -g default-shell /bin/bash
## start interactive shell instead of login shell
# set-option -g default-command 'env -i HOME=$HOME /bin/bash'
set-option -g default-command '/bin/bash'
#bind -n C-M-h
#### COLOUR (Solarized 256)
# default statusbar colors
set-option -g status-style default,bg=colour235,fg=colour136
# default window title colors
set-window-option -g window-status-style fg=colour244,bg=default
#set-window-option -g window-status-attr dim
# pane border
set-option -g pane-border-style fg=colour235 #base02
set-option -g pane-active-border-style fg=colour240 #base01
# message text
set-option -g message-style bg=colour235 #base02
set-option -g message-style fg=colour166 #orange
# pane number display
set-option -g display-panes-active-colour colour33 #blue
set-option -g display-panes-colour colour166 #orange
# clock
set-window-option -g clock-mode-colour colour64 #green
#bind C-w run-shell "tmux show-buffer | xclip -sel clip -i > /dev/null" \; display-message "Copied tmux buffer to system clipboard"
#bind C-y run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer"
bind C-r source-file ~/.tmux.conf \; display-message "TMUX reloaded!"
#bind R rename-window
# set -g mouse-utf8 on
set -g mouse on
### mouse scrolling ###
# bind -n WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
# bind -n WheelDownPane select-pane -t= \; send-keys -M
## 2
bind -n WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M \; send-keys -M \; send-keys -M \; send-keys -M \;
bind -n WheelDownPane select-pane -t= \; send-keys -M \; send-keys -M \; send-keys -M \; send-keys -M \;
bind -n MouseUp1Pane select-pane -t= \; send-keys C-c
bind -n MouseDown1Pane select-pane -t= \; copy-mode -e
# bind -n MouseDrag1Pane select-pane -t= \; copy-mode -e \;
# bind -n MouseDrag1Pane display-message "start draggg"
# bind -n MouseDragEnd1Pane display-message "end draggg"
# bind -T copy-mode MouseUp1Pane display-message "mouseup1pane cm"
# bind -T copy-mode MouseUp1Pane display-message "mouseup1pane cmvi"
# bind -T root MouseUp1Pane display-message "mouseup1pane root"
### COPY / PASTE
set-window-option -g mode-keys vi
bind P paste-buffer
bind-key -T copy-mode-vi 'v' send -X begin-selection
#bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe 'xclip -in -selection clipboard >/dev/null'
#bind-key -t vi-copy y copy-pipe 'xclip -in -selection clipboard >/dev/null'
# bind-key -t vi-copy r display-message 'jaws'
# rectangle-toggle \; begin-selection
# bind-key -t vi-copy 'v' begin-selection
# bind-key -T copy-mode v send-keys begin-selection
# bind-key -t vi-copy 'y' copy-selection
# bind-key -T copy-mode y send-keys copy-selection
# bind -n MouseDragEnd1Pane copy-selection \; run 'tmux show-buffer | xclip -sel c >/dev/null'
# copy-pipe 'xclip -in -selection clipboard >/dev/null'
# The following ideas never worked well and have been replaced with 2 i3 shortcuts to 2 bash scripts
# C-c: save into system clipboard (+). With preselection.
#bind C-c choose-buffer "run \"tmux save-buffer -b %% - | xclip -i -sel clipboard\" \; run \" tmux display \\\"Clipboard \(+\) filled with: $(tmux save-buffer -b %1 - | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \\\" \" "
#bind C-c run "jaw-copy-to-clipboard"
# C-v: copy from + clipboard.
#bind C-v run "tmux set-buffer \"$(xclip -o -sel clipboard)\"; tmux paste-buffer" \; run "tmux display \"Copied from \(+\) $(xclip -o -sel clipboard | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \""
# C-d: save into selection clipboard (*). With preselection.
#ind C-d choose-buffer "run \"tmux save-buffer -b %% - | xclip -i\" \; run \" tmux display \\\"Clipboard \(*\) filled with: $(tmux save-buffer -b %1 - | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \\\" \" "
# C-f: copy from * clipboard.
#bind C-f run "tmux set-buffer \"$(xclip -o)\"; tmux paste-buffer" \; run "tmux display \"Copied from \(*\) $(xclip -o | dd ibs=1 obs=1 status=noxfer count=80 2> /dev/null)... \""
#window movement [@TODO needs rethinking]
#bind C-u swap-window -t -1
#bind C-i swap-window -t +1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment