-
Notifications
You must be signed in to change notification settings - Fork 1
/
.tmux.conf
131 lines (105 loc) · 4.39 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
# set ctrl space as command
unbind C-b
set-option -g prefix C-Space
bind-key C-Space send-prefix
if-shell "test -f ~/.tmux/tmuxline_theme.sh" "source ~/.tmux/tmuxline_theme.sh"
# some stuff
set -g default-terminal "tmux-256color"
# set -g default-terminal 'screen-256color'
set -g history-limit 100000
set-option -g set-titles on
set-option -g set-titles-string "tmux:#S #W #T"
# set-option -g default-shell /bin/bash
set -g extended-keys on
set-option -g default-shell /bin/zsh
set-option -g detach-on-destroy off
setw -g aggressive-resize on
# enable clicking
set -g mouse on
# split panes using | and -
bind c new-window -c "#{pane_current_path}"
bind ü split-window -h -c "#{pane_current_path}"
bind ö split-window -v -c "#{pane_current_path}"
unbind '"'
unbind %
bind Escape copy-mode
bind p paste-buffer
bind ő copy-mode # map [ to the place it would be on English keyboards
bind -T copy-mode-vi v send -X begin-selection
bind ú paste-buffer ## map ] to the place it would be on English keyboards
setw -g mode-keys vi
###########################
# Plugins
###########################
# To install plugins:
# 1) Add plugin down here
# 2) Prefix + I to install plugin
# To update plugins:
# 1) Prefix + U
# To remove plugins:
# 1) Remove line down here
# 2) Prefix + ALT + U
# set -g @resurrect-processes '\
# ssh \
# ranger \
# "yarn serve" \
# nodemon '
set -g @plugin 'tmux-plugins/tpm'
# set -g @plugin 'ofirgall/tmux-window-name'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-capture-pane-contents 'on'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-save-interval '1'
set -g @continuum-restore 'on'
# set -g @continuum-boot 'on'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-copycat'
set -g @plugin 'tmux-plugins/tmux-open'
# alt-i will copy/paste lines from visible panes
set -g @plugin 'woodstok/tmux-butler'
set -s escape-time 0
set -g @plugin 'sainnhe/tmux-fzf'
set -g @resurrect-restore 'R'
set -g @resurrect-save 'S'
# tmux resurrect looses ENV-s, so ln -s ~/.local/bin/fzf ~/.fzf/bin needs to be done
bind "C-s" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/session.sh attach"
bind "C-w" run-shell "$HOME/.tmux/plugins/tmux-fzf/scripts/pane.sh switch"
bind "c-n" command-prompt -I "new -s "
set -g focus-events on
# replace ~/.local/bin/fzf-panes.tmux to your path of fzf-panes.tmux
if-shell '[ -f ~/.tmux/scripts/fzf-panes.tmux ]' {
# if you want to exclude specified session, please set @fzf_panes_ex_session_pat
# for example, value equal to '^(floating)$', will exclude panes in session named 'floating'
# set -g '@fzf_panes_ex_session_pat' '^(floating)$'
set-hook -g pane-focus-in[10] \
"run -b 'bash ~/.tmux/scripts/fzf-panes.tmux update_mru_pane_ids'"
bind "C-p" run -b 'bash ~/.tmux/scripts/fzf-panes.tmux new_window'
bind "," run -b 'bash ~/.tmux/scripts/fzf-panes.tmux select_last_pane'
} {
set-hook -ug pane-focus-in[10]
bind w choose-tree -Z
}
if "test ! -d ~/.tmux/plugins/tpm" \
"run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
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'
bind-key -n 'C-é' if-shell "$is_vim" 'send-keys C-é' 'select-pane -l'
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
bind-key -T copy-mode-vi 'C-é' select-pane -l