/
.tmux.conf
92 lines (80 loc) · 3.27 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
# .tmux.conf反映
bind r source-file ~/.tmux.conf
# mouse有効
set-option -g mouse on
# prefix変更
set-option -g prefix C-s
bind C-s send-prefix
unbind C-b
# status bar style
set-option -g default-terminal screen-256color
set -ga terminal-overrides ',xterm-256color:Tc'
set-option -g status-position top
set-option -g status-bg "colour56"
set-option -g status-fg "colour15"
set-option -g status-left '[#P] '
# pane color
set -g window-style bg=colour234
set -g window-active-style bg=colour232
set -g pane-border-style fg=colour234
set -g pane-active-border-style fg=colour15
# paneサイズ変更
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
bind -n S-left resize-pane -L 3
bind -n S-down resize-pane -D 3
bind -n S-up resize-pane -U 3
bind -n S-right resize-pane -R 3
# pane分割
bind c new-window -c '#{pane_current_path}'
bind v split-window -h -c '#{pane_current_path}'
bind s split-window -v -c '#{pane_current_path}'
# pane入れ替え
bind left swap-pane -U
bind right swap-pane -D
bind up swap-pane -U
bind down swap-pane -D
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
# copy and paste settings
bind b previous-window
bind y copy-mode
# bind p paste-buffer
setw -g mode-keys vi
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi V send -X select-line
bind -T copy-mode-vi C-v send -X rectangle-toggle
# bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "clip.exe"
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "clip.exe"
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "clip.exe"
# コピーモードでvimキーバインドを使う
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-open'
run '~/.tmux/plugins/tpm/tpm'
# 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'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'C-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"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
# フォーカス有無による背景色切り替え
set-option -g focus-events on
setw -g window-active-style bg=#010103;
setw -g window-style bg=default
set -g pane-active-border-style fg=#00ffff,bg=default
set -g pane-border-style fg=white,bg=default