/
.tmux.conf
103 lines (87 loc) · 3.85 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
# tmux setting
# パッケージ管理: tpm
# https://github.com/tmux-plugins/tpm
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
# TMUX THEME
set -g @plugin 'janoamaral/tokyo-night-tmux'
set -g @plugin 'catppuccin/tmux'
set -g @catppuccin_flavour 'latte' # or frappe, macchiato, mocha
# # 起動shellをfishに
# if-shell 'uname -a | grep -iE "^.*linux.*microsoft.*$"' \
# "set -g default-shell /usr/bin/fish"
# if-shell 'uname -a | grep -iE "Darwin"' \
# "set -g default-shell /usr/local/bin/fish"
# # powerline
# # 以下でインストール
# # pip install --user powerline-status
# # run-shell "powerline-daemon -q"
# if-shell 'uname -a | grep -iE "^.*linux.*microsoft.*$"' \
# 'source "/usr/local/lib/python2.7/dist-packages/powerline/bindings/tmux/powerline.conf"'
# if-shell 'uname -a | grep -iE "Darwin"' \
# 'source "/Users/takenaka/Library/Python/3.7/lib/python/site-packages/powerline/bindings/tmux/powerline.conf"'
# truecolor
set -g default-terminal "screen-256color"
set -ga terminal-overrides ",xterm-256color:Tc"
# set -ga terminal-overrides ",xterm-256color-italic:Tc"
# escの遅延を避ける
# 0だとWSLでコンソールに 0;10;1c と出力されてしまうので50ms避ける
set -sg escape-time 50
# statusバーを頭に
set -g status-position top
# statusバー1秒ごと描画
set -g status-interval 1
# powerlineがない場合、以下を適用する
# # 右部分
# set -g status-right-length 150
# set -g status-right '#[fg=green]#(get_battery_tmux) [%Y-%m-%d(%a) %T]'
set -g status-right '#{?client_prefix,#[bg=colour1]#[fg=colour255] tmux-prefix ,}#[bg=colour129, fg=colour255]#{?pane_mode, ,}#{pane_mode}#{?pane_mode, ,}#[fg=colour245, bg=colour235]|WAN:#[fg=colour2]#(touch -a /var/tmp/ipv4; command find /var/tmp -name ipv4 -and \( -mmin +5 -or -size 0 \) -exec curl -s -4 ifconfig.co -o {} \;; cat /var/tmp/ipv4) #[fg=colour245]|#[fg=colour255]#h '
# prefixをC-qに
set -g prefix C-q
unbind C-b
# prefix + r で設定再読込
unbind r
bind r source-file ~/.tmux.conf
# pane操作 キーバインド
bind-key k select-pane -U
bind-key j select-pane -D
bind-key h select-pane -L
bind-key l select-pane -R
bind-key -r K resize-pane -U 2
bind-key -r J resize-pane -D 2
bind-key -r H resize-pane -L 2
bind-key -r L resize-pane -R 2
# スクロール、コピー、選択modeでvimモードを使用
set-window-option -g mode-keys vi
# set -g @plugin 'tmux-plugins/tmux-yank'
# コピーモードを設定する
# コピーモードでvimキーバインドを使う
setw -g mode-keys vi
# 'Esc' で中断
bind -T copy-mode-vi Escape send -X cancel
# 'v' で選択を始める
bind -T copy-mode-vi v send -X begin-selection
# 'V' で行選択
bind -T copy-mode-vi V send -X select-line
# 'C-v' で矩形選択
bind -T copy-mode-vi C-v send -X rectangle-toggle
# 'y' でヤンク
bind -T copy-mode-vi y send -X copy-selection
# 'Y' で行ヤンク
bind -T copy-mode-vi Y send -X copy-line
# 'C-p'でペースト
bind-key C-p paste-buffer
# Archのときのヤンク設定
if-shell 'uname -a | grep -iE "^Linux.+arch.+GNU/Linux$"' \
'MESSAGE="display-message -p \"\[NOTICE\] xsel is require in copy-mode\"; set-hook -gu session-created;"; \
set-hook -g session-created ${MESSAGE};'
if-shell 'uname -a | grep -iE "^Linux.+arch.+GNU/Linux$"' \
'bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xsel -i -p && xsel -o -p | xsel -i -b"'
# WSLのみ設定
# コピー&ペースト
# 参考: https://github.com/wamei/.dotfiles/blob/master/.tmux.confi
# 参考: https://qiita.com/b-inary/items/0f29a825f041787430ff
# if-shell 'test -n (uname -a | grep Microsoft)' 'bind -T copy-mode-vi MouseDragEnd1Pane send-Keys -X copy-pype-and-cancel "win32yank.exe -i --crlf"'
# if-shell 'test -n (uname -a | grep Microsoft)' 'bind -n
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'