-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
88 lines (73 loc) · 3.57 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
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
# Enables displaying battery percentage and status icon in tmux status-right
set -g @plugin 'tmux-plugins/tmux-battery'
# A plugin that enhances tmux search
set -g @plugin 'tmux-plugins/tmux-copycat'
# Restore tmux environment after system restart.
set -g @plugin 'tmux-plugins/tmux-resurrect'
# Continuous saving of tmux environment
set -g @plugin 'tmux-plugins/tmux-continuum'
# A set of tmux options that should be acceptable to everyone
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank'
# Use brew installed zsh as default shell
set-option -g default-shell /usr/local/bin/zsh
# set up terminal to support true color
# https://www.reddit.com/r/neovim/comments/825dj7/the_endless_litany_of_tmux_and_nvim_color_problems/dvc2boh/
set -s default-terminal screen-256color
set -as terminal-overrides ",*-256color:Tc"
# Hack to not rename window to binary
set-option -g allow-rename off
# 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 -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n 'C-\' if-shell "$is_vim" "send-keys 'C-\\'" "select-pane -l"
set-option -g history-limit 100000
# Open a new window with its working directory set to current pane's working directory
bind c new-window -c "#{pane_current_path}"
# Split panes using | and -
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
# Resize panes using alt-movement
bind-key -n M-j resize-pane -D
bind-key -n M-k resize-pane -U
bind-key -n M-h resize-pane -L
bind-key -n M-l resize-pane -R
# Turn on vi bindings in copy mode
set-window-option -g mode-keys vi
# Setup 'v' and 'y' as in vim
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
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
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection
# Enable mouse support
set -g mouse on
# Do not copy selection and cancel copy mode on drag end event
# Prefer iTerm style selection: select, then mouse click to copy to buffer
unbind -T copy-mode-vi MouseDragEnd1Pane
bind -T copy-mode-vi MouseDown1Pane select-pane \;\
send-keys -X copy-pipe "pbcopy" \;\
send-keys -X clear-selection
# easier and faster switching between next/prev window
bind -n M-p previous-window
bind -n M-m next-window
# alternatively, check file exists before sourcing it in tmux.conf
if-shell "test -f ~/.tmux/tmuxline.conf" "source ~/.tmux/tmuxline.conf"
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'