Skip to content

Commit 826e8c2

Browse files
authored
Update tmux.conf
1 parent ee29535 commit 826e8c2

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

tmux.conf

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
1111
setw -g mode-keys vi
1212

1313
# mouse behavior
14-
set -g mouse-utf8 on
15-
# set -g mouse on
14+
set -g mouse on
1615

1716
set-option -g default-terminal screen-256color
1817

@@ -56,32 +55,41 @@ bind-key T previous-window
5655
bind-key [ copy-mode
5756
bind-key ] paste-buffer
5857

59-
# Setup 'v' to begin selection as in Vim
60-
bind-key -t vi-copy v begin-selection
61-
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
58+
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"
6259

60+
# Setup 'v' to begin selection as in Vim
6361
# Update default binding of `Enter` to also use copy-pipe
64-
unbind -t vi-copy Enter
65-
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
62+
#
63+
# New keybindings for vi-mode when version >= 2.4
64+
# https://github.com/tmux/tmux/issues/754
65+
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
66+
'bind-key -T copy-mode-vi v send-keys -X begin-selection ; \
67+
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" ; \
68+
unbind -T copy-mode-vi Enter ; \
69+
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"; ' \
70+
'bind-key -t vi-copy v begin-selection ; \
71+
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy" ; \
72+
unbind -t vi-copy Enter ; \
73+
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"; '
6674

6775
set-window-option -g display-panes-time 1500
6876

6977
# Status Bar
7078
set-option -g status-interval 1
7179
set-option -g status-left ''
7280
set-option -g status-right '%l:%M%p'
73-
set-window-option -g window-status-current-fg magenta
81+
# set-window-option -g window-status-current-fg magenta
7482
set-option -g status-fg default
7583

7684
# Status Bar solarized-dark (default)
7785
set-option -g status-bg black
78-
set-option -g pane-active-border-fg black
79-
set-option -g pane-border-fg black
86+
# set-option -g pane-active-border-fg black
87+
# set-option -g pane-border-fg black
8088

8189
# Status Bar solarized-light
8290
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g status-bg white"
83-
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white"
84-
if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white"
91+
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-active-border-fg white"
92+
# if-shell "[ \"$COLORFGBG\" = \"11;15\" ]" "set-option -g pane-border-fg white"
8593

8694
# Set window notifications
8795
setw -g monitor-activity on
@@ -94,8 +102,8 @@ set-option -g default-command "/bin/bash -c 'which reattach-to-user-namespace >/
94102
set-option -g repeat-time 0
95103

96104
# Fix to allow mousewheel/trackpad scrolling in tmux 2.1
97-
# bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
98-
# bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
105+
bind-key -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"
106+
bind-key -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"
99107

100108
# Disable assume-paste-time, so that iTerm2's "Send Hex Codes" feature works
101109
# with tmux 2.1. This is backwards-compatible with earlier versions of tmux,

0 commit comments

Comments
 (0)