-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.tmux.conf
115 lines (90 loc) · 3.93 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
# Brian Ustas's .tmux.conf
# Tested on OS X.
# Make zsh the default shell.
set -g default-shell $SHELL
# Enable 256 color support.
# https://github.com/neovim/neovim/issues/7353#issuecomment-334279343
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# For Neovim (advised after running :checkhealth in Vim)
set -g focus-events on
# Act like GNU Screen.
set -g prefix C-a
unbind-key C-b
# To send C-a to the shell: C-a, C-a
bind-key C-a send-prefix
# Increase scrollback lines.
set -g history-file ~/.tmux_history
set -g history-limit 50000
# Allows for faster key repetition.
set -g escape-time 0
# Start status bar numbering at 1.
set -g base-index 1
# Rename windows based on what's running in them.
setw -g automatic-rename on
# Renumber existing windows when windows are destroyed.
set -g renumber-windows on
# Enable mouse support (-q for quiet).
set -g -q mouse on
# Ctrl-p/n for tmux command history in the status bar.
set -g status-keys emacs
# ENV vars to be updated when creating a new session.
# https://stackoverflow.com/a/9833996/1575238
# ITERM_PROFILE is needed by tmux/apply_theme.conf
set -ga update-environment "ITERM_PROFILE"
# Enter copy-mode with PREFIX [
# To list all bindings: :list-keys -T copy-mode-vi
setw -g mode-keys vi
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 \; send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
# Disable confirmation prompt before killing windows and panes.
bind-key & kill-window
bind-key x kill-pane
# Always list windows in the top left corner.
bind-key w select-pane -t 0 \; choose-window
# Resize panes using PREFIX H, J, K, L
bind-key -r H resize-pane -L 5
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r L resize-pane -R 5
# Quickly cycle through window layouts.
bind-key -r Space next-layout
# Quickly reload .tmux.conf
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
# 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"
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
# Don't display the original name when renaming. Makes renaming faster.
bind-key , command-prompt -p "(rename-window '#W')" "rename-window '%%'"
bind-key '$' command-prompt -p "(rename-session '#S')" "rename-session '%%'"
# Create new split/window with the current directory.
# https://unix.stackexchange.com/a/12091
bind-key '"' split-window -p 50 -c "#{pane_current_path}"
bind-key % split-window -h -p 50 -c "#{pane_current_path}"
bind-key c new-window -c "#{pane_current_path}"
# Shortcut to toggle synchronize-panes.
bind-key s set-window-option synchronize-panes
# Status bar
set -g clock-mode-style 24
set -g status-left " #[fg=magenta,bold]« #[fg=blue,nobold]#S #[fg=magenta,bold]» "
set -g status-left-length 32 # maximum width
set -g status-right "%a %H:%M %m-%d-%y "
set -g status-interval 15
set -g window-status-format " #I:#W#{?window_zoomed_flag, [Z],} "
set -g window-status-current-format " #I:#W#{?window_zoomed_flag, [Z],} "
# Colors
# Looks at ITERM_PROFILE to pick the correct colorscheme.
set-hook -g after-new-session "source-file ~/dotfiles/tmux/apply_theme.conf"
set-hook -g after-new-window "source-file ~/dotfiles/tmux/apply_theme.conf"