-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmux.conf
138 lines (106 loc) · 4.28 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
# Lots copy from junegunn
#
# https://github.com/junegunn/dotfiles/blob/master/tmux.conf
# bind-key (alias: bind)
# set-window-option (alias: setw)
# ==============================================================================
# SESSION OPTIONS
# ==============================================================================
# Change default bind key
unbind-key c-b
set -g prefix C-Space
bind-key c-a send-prefix
# Mouse
set-option -g mouse on
set-option -s set-clipboard off
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
# Index starts from 1
set -g base-index 1
# start pane index at 1
setw -g pane-base-index 1
set -g default-terminal "screen-256color"
set-option -ga terminal-overrides ",screen-256color:Tc"
# set -ga terminal-overrides ",xterm-256color:Tc"
# No delay for escape key press
set -sg escape-time 0
# renumber windows after close
set -g renumber-windows on
# Key binding in status line
set-option -g status-keys emacs
# Reload tmux config
bind R source-file ~/.tmux.conf
# Load dev split script
bind D source-file ~/.tmux/dev
# Key binding choose-tree
bind s choose-tree
# Last session
bind L switch-client -l
# ==============================================================================
# WINDOW OPTIONS
# ==============================================================================
# Automatically set window title
#setw -g automatic-rename on
# Copy-mode
setw -g mode-keys vi
setw -g history-limit 100000
setw -g monitor-activity on
# set -g visual-activity on
setw -g aggressive-resize on
bind l last-window
# ==============================================================================
# KEY BINDINGS
# ==============================================================================
# Remap keys to vim-like navigation
# bind h select-pane -L
# bind j select-pane -D
# bind k select-pane -U
# bind l select-pane -R
# bind H resize-pane -L 10
# bind J resize-pane -D 10
# bind K resize-pane -U 10
# bind L resize-pane -R 10
bind M-h resize-pan -L
bind M-j resize-pan -D
bind M-k resize-pan -U
bind M-l resize-pan -R
# Create new window/panes and cd to current path
unbind %
unbind '"'
bind c new-window -c "#{pane_current_path}"
bind - split-window -c "#{pane_current_path}"
bind | split-window -h -c "#{pane_current_path}"
# Break/join panes
# bind j command-prompt -p "join pane from:" "join-pane -s ':%%'"
bind S command-prompt -p "send pane to:" "join-pane -t ':%%'"
# Copy-mode
bind -T copy-mode-vi 'v' send -X begin-selection
if-shell -b '[ `uname -s` = "Linux" ]' '\
bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -sel clip -i"; \
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -se c -i";'
if-shell -b '[ `uname -s` = "Darwin" ]' \
'bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"'
# Capture pane and open in Vim
bind M-c run 'tmux capture-pane -S -102400 -p > /tmp/tmux-capture.txt'\; new-window "view /tmp/tmux-capture.txt"
# bind-key M-c run "screencapture -l$(osascript -e 'tell app \"iTerm\" to id of window 1') -x -o -P /tmp/$(date +%Y%m%d-%H%M%S).png"
set-option -g allow-rename off
# 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 -b "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell -b "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell -b "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell -b "$is_vim" "send-keys C-l" "select-pane -R"
# bind-key -n C-\ if-shell -b "$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
# Swap window
bind T command-prompt -p "swap window with:" "swap-window -t ':%%'"
# ==============================================================================
# THEMING
# ==============================================================================
if-shell "test -f ~/.dotfiles/tmuxline-snapshot" "source ~/.dotfiles/tmuxline-snapshot"
# nvim guicursor
set -ga terminal-overrides ',*:Ss=\E[%p1%d q:Se=\E[2 q'