-
Notifications
You must be signed in to change notification settings - Fork 109
/
tmux.conf
138 lines (116 loc) · 5.19 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# use C-a, since it's on the home row and easier to hit than C-b
set-option -g prefix C-a
unbind-key C-a
bind-key C-a send-prefix
set -g base-index 1
# Easy config reload
bind-key R source-file ~/.tmux.conf \; display-message "tmux.conf reloaded."
# edit tmux.conf or tmux-status
bind E new-window -n 'tmux.conf' 'nvim ~/.dotfiles/tmux.conf && tmux source ~/.tmux.conf && tmux display "~/.tmux.conf sourced"'
bind S new-window -c 'tmux-status.conf' 'nvim ~/.config/tmux/tmux-status.conf && tmux source ~/.tmux.conf && tmux display "~/.tmux.conf sourced"'
# edit vimrc
bind N new-window -n 'nimrc' 'cd ~/.config/nvim && nvim'
# edit zshrc
bind Z new-window -n 'zshrc' 'nvim ~/.dotfiles/zshrc && source ~/.zshrc && tmux desplay ".zshrc updated"'
# vi is good
setw -g mode-keys vi
# set -g status-keys vi
# set -g default-terminal "xterm-kitty"
set -g default-terminal "${TERM}"
# set-option -ga terminal-overrides ',$TERM:Tc,*:Ss=\E[%p1%d q:Se=\E[2 q'
# set-option -ga terminal-overrides ",$TERM:Tc"
# set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm'
set -as terminal-overrides ',*:Smulx=\E[4::%p1%dm' # undercurl support
set -as terminal-overrides ',*:Setulc=\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m' # underscore colours - needs tmux-3.0
set -g focus-events on
set -sg escape-time 0
# mouse behavior
set-option -g -q mouse on
bind-key : command-prompt
bind-key r refresh-client
bind-key L clear-history
bind-key Q set -g status
bind-key space next-window
bind-key bspace previous-window
bind-key enter next-layout
# use vim-like keys for splits and windows
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# smart pane switching with awareness of vim splits
# is_vim="ps -a | grep -qE '#{s|/dev/||:pane_tty}''.*(n?)vim'"
is_vim="ps -o state=,tty=,comm= | grep -iqE '^[^TXZ ]+ +#{s|/dev/||:pane_tty}\s+(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
# is_vim="~/.config/is_vim.sh '#{pane_tty}'"
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"
bind C-l send-keys 'C-l'
bind-key C-o rotate-window
bind-key + select-layout main-horizontal
bind-key = select-layout main-vertical
set-window-option -g other-pane-height 40
set-window-option -g other-pane-width 90
bind-key a last-pane
bind-key q display-panes
bind-key c new-window -c "#{pane_current_path}"
bind-key t next-window
bind-key T previous-window
bind-key [ copy-mode
bind-key ] paste-buffer
# Use vim keybindings in copy mode
# # Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
#
# # Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -Tcopy-mode-vi Enter send -X copy-selection-and-cancel
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'
# # Setup 'v' to begin selection as in Vim
# bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# # Update default binding of `Enter` to also use copy-pipe
# unbind -t vi-copy Enter
# bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
#
# set-window-option -g display-panes-time 1500
# Enable native Mac OS X copy/paste
set-option -g default-command "reattach-to-user-namespace -l $SHELL"
# set-option -g default-command "/usr/local/bin/zsh -c 'which reattach-to-user-namespace >/dev/null && exec reattach-to-user-namespace $SHELL -l || exec $SHELL -l'"
# Allow the arrow key to be used immediately after changing windows
set-option -g repeat-time 0
# set-environment -g PATH "/usr/local/bin:/bin:/usr/bin"
# set -g @continuum-restore 'off'
#====== START THE STATUS BAR =============#
source-file $HOME/.config/tmux/tmux-status.conf
# List of plugins
set -g monitor-activity on
# Supports `github_username/repo` or full git repo URLs
set-environment -g TMUX_PLUGIN_MANAGER_PATH '$HOME/.config/tmux/plugins/'
set -g @tpm_plugins ' \
tmux-plugins/tpm \
tmux-plugins/tmux-battery \
tmux-plugins/tmux-cpu \
mhartington/tmux-mail \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-continuum \
tmux-plugins/tmux-yank \
'
# christoomey/vim-tmux-navigator \
# Other examples:
# github_username/plugin_name \
# [email protected]/user/plugin \
# [email protected]/user/plugin \
# Initializes TMUX plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell $HOME/.config/tmux/plugins/tpm/tpm
# Fig Tmux Integration: Enabled
# source-file ~/.fig/tmux
# End of Fig Tmux Integration