-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdot_tmux.conf
More file actions
130 lines (110 loc) · 4.85 KB
/
dot_tmux.conf
File metadata and controls
130 lines (110 loc) · 4.85 KB
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
124
125
126
127
128
129
130
# List of TPM-managed plugins
set -g @plugin "arcticicestudio/nord-tmux"
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-sensible'
# In order to be executed periodically, the tmux-continuum plugin updates the
# status-right tmux variable. In case some plugin (typically themes, such as
# nord-tmux) overwrites the status-right variable, the autosave feature will
# stop working. To fix this issue, we place tmux-continuum last in the TPM
# plugins list.
set -g @plugin 'tmux-plugins/tmux-continuum'
# -----------------------------------------------------------------------------
# Claude Code CLI Configuration
# -----------------------------------------------------------------------------
# For multiline input in Claude Code when running inside tmux:
#
# Primary method: Option+Enter (⌥+↵)
# - Requires iTerm2 configured with Option keys set to "Esc+"
# - Settings: Profiles → Keys → General → Set both Option keys to "Esc+"
# - Works identically inside and outside tmux
#
# Alternative method: Backslash + Enter (\↵)
# - Works in all terminals without configuration
# - More cumbersome but always available
#
# Note: Shift+Enter does not work reliably within tmux sessions due to
# terminal detection issues. Claude Code checks TERM_PROGRAM which reports
# "tmux" instead of "iTerm.app", preventing the /terminal-setup command
# from being available.
# -----------------------------------------------------------------------------
# Ensure tmux automatically opens on boot in iTerm maximised to fullscreen
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm,fullscreen'
# Enable continuous saving and auto-restore of tmux environment
set -g @continuum-restore 'on'
# Force 256 colours and enable extended keys (required for tmux 3.6+)
set -g default-terminal "tmux-256color"
set-option -g terminal-overrides "xterm*:colors=256:Tc,screen:colors=256"
set-option -ga terminal-overrides ",xterm-256color:Tc"
# Enable focus events for better terminal integration
set-option -g focus-events on
# Enable extended keys (required for Option+Enter in tmux 3.6+)
set-option -s extended-keys on
set-option -as terminal-features 'xterm*:extkeys'
# Use vi mode. To see the available commands:
# C-b :
# list-keys -T copy-mode-vi
set-window-option -g mode-keys vi
set-option -g status-keys vi
unbind [
bind Escape copy-mode # ctrl-b esc
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-selection
bind -Tcopy-mode-vi Enter send-keys -X copy-pipe-and-cancel "pbcopy"
setw -g xterm-keys on
# Renumber windows when closed
set-option -g renumber-windows on
# Meta+arrow to switch windows
bind -n M-Left previous-window
bind -n M-Right next-window
# CTRL-p/n to switch windows
bind-key -n 'C-p' previous-window
bind-key -n 'C-n' next-window
# CTRL-SHIFT-n/p to swap windows right/left
bind-key -n C-S-Left swap-window -t -1\; select-window -t -1
bind-key -n C-S-Right swap-window -t +1\; select-window -t +1
# Use Shift-arrow keys without prefix key to resize panes
bind -n S-Up resize-pane -U
bind -n S-Down resize-pane -D
bind -n S-Left resize-pane -L
bind -n S-Right resize-pane -R
# 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"
bind-key -n 'C-\' if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# Find a window by name
bind-key / command-prompt "find-window %1"
# Disable mouse in tmux
set-option -g mouse off
# Set status bar
set -g status-justify centre
set -g status-bg black
set -g status-fg white
set -g visual-activity on
set-window-option -g window-status-current-style bg=red
# Automatically set window title & titles
setw -g automatic-rename
set-option -g set-titles on
set-option -g set-titles-string '[#I] #T - #W'
# Turn off all bells
set-option -g bell-action none
set-option -g visual-bell off
# C-b r to reload the tmux configuration
bind r source-file ~/.tmux.conf
# If we have a tmuxline snapshot, source it
#if-shell "test -f ~/.tmux_tmuxline.conf" "source ~/.tmux_tmuxline.conf"
#source-file ~/.tmux_tmuxline.conf
# If TMUX plugin manager is not yet installed, install it and then install
# the plugins
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
# Initialize TMUX plugin manager (keep this line at the very bottom of
# tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'