-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtmux.conf
123 lines (94 loc) · 4.58 KB
/
tmux.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
unbind-key C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
bind-key a last-window
bind-key r source-file ~/.tmux.conf \; display "Reloaded!"
set -g base-index 1
set-window-option -g pane-base-index 1
set-window-option -g set-clipboard on
# set -g status-fg white
# set -g status-bg black
# set-window-option -g window-status-style fg=cyan,bg=default,dim
# set-window-option -g window-status-current-style fg=white
# set -g pane-border-style fg=green,bg=black
# set -g pane-active-border-style fg=white,bg=green
set -g status-interval 60
set -g status-justify centre
set-window-option -g monitor-activity on
set -g visual-activity on
set -g status-left-length 40
# set -g status-left "#[fg=green]Session: #s #[fg=yellow]#I #[fg=cyan]#P"
# set -g status-right "#[fg=green]#H #[fg=cyan]%d %b %R"
bind-key P pipe-pane -o "cat >> ~/#W-tmux.log" \; display-message "Toggled logging to ~/#W-tmux.log"
bind-key C-t last-pane \; send-keys C-p C-m \; last-pane
### Shared with Byobu ###
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-option -ga terminal-overrides ",*-256color:RGB"
set -s escape-time 1
set -g default-shell /usr/bin/fish
# Keep ssh-agent through detached sessions
set -g update-environment 'SSH_AUTH_SOCK'
set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock
set-option -g history-limit 100000
set-window-option -g aggressive-resize on
set-window-option -g xterm-keys on
set-window-option -g mode-keys vi
set -g focus-events on
# set -g status-utf8 on
# set-window-option -g utf8 on
unbind-key C-z
bind-key - split-window -v -c "#{pane_current_path}"
bind-key | split-window -h -c "#{pane_current_path}"
bind-key '"' split-window -v -c "#{pane_current_path}"
bind-key % split-window -h -c "#{pane_current_path}"
bind-key c new-window -c "#{pane_current_path}"
bind-key m split-window -h -l 38% -c "#{pane_current_path}"
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# Smart pane switching with awareness of Vim splits.
# See: https://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'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"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
# Bind C-l and C-k, hidden by vim-tmux-navigator. Note: use <prefix> C-k and
# <prefix> C-l
bind-key C-k send-keys 'C-k'
bind-key C-l send-keys 'C-l'
##
# Copy and paste with the mouse
# https://unix.stackexchange.com/questions/318281/how-to-copy-and-paste-with-a-mouse-with-tmux/635231?noredirect=1#comment1406951_635231
# Linux only
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
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -T copy-mode-vi C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-vi C-WheelDownPane send-keys -X halfpage-down
bind -T copy-mode-emacs C-WheelUpPane send-keys -X halfpage-up
bind -T copy-mode-emacs C-WheelDownPane send-keys -X halfpage-down
# To copy, left click and drag to highlight text in yellow,
# once you release left click yellow text will disappear and will automatically be available in clibboard
# # Use vim keybindings in copy mode
setw -g mode-keys vi
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "xclip -selection c"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"