Skip to content

Instantly share code, notes, and snippets.

@yujiod
Last active March 30, 2021 14:40
Show Gist options
  • Save yujiod/4d810164f01d7a152e88 to your computer and use it in GitHub Desktop.
Save yujiod/4d810164f01d7a152e88 to your computer and use it in GitHub Desktop.
tmux dot file
set-option -g default-shell /usr/local/bin/fish
set-option -g default-command /usr/local/bin/fish
set-option -g set-titles on
# auto window rename
setw -g automatic-rename
# mouse setting
set -g mouse on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# log output
bind-key H pipe-pane 'cat >> $HOME/.tmux/tmux-#W.log' \; display-message 'Started logging to $HOME/.tmux/tmux-#W.log'
bind-key h pipe-pane \; display-message 'Ended logging to $HOME/.tmux/tmux-#W.log'
# customize F1~F4
bind-key -n F1 next-layout
bind-key -n F2 new-window ; rename-window -
bind-key -n F3 previous-window
bind-key -n F4 next-window
# clipboard
setw -g mode-keys vi
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
## for WSL2
if-shell -b 'test "$(uname -a | grep microsoft)" != ""' \
'bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "cat | win32yank.exe -i"; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "cat | win32yank.exe -i"; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "cat | win32yank.exe -i"; \
bind-key C-p run-shell "win32yank -o | tmux load-buffer - && tmux paste-buffer"'
## for Mac
if-shell -b 'test "$(uname -a | grep Darwin)" != ""' \
'bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "pbcopy"; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "pbcopy"; \
bind-key C-p run-shell "pbpaste | tmux load-buffer - && tmux paste-buffer"'
## for Linux
if-shell -b 'test "$(uname -a | grep Linux | grep -v microsoft )" != ""' \
'bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xsel --clipboard --input"; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel --clipboard --input"; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xsel --clipboard --input"; \
bind-key C-p run-shell "xsel | tmux load-buffer - && tmux paste-buffer"'
bind e setw synchronize-panes on
bind E setw synchronize-panes off
set -g pane-border-style fg=colour243
set -g pane-active-border-style fg=red,bg=default
setw -g window-status-current-style fg=black,bg=white
setw -g window-status-bell-style fg=white,bg=colour240
setw -g window-status-activity-style fg=white,bg=colour240
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment