-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
executable file
·123 lines (104 loc) · 4.23 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
#unbind-key -a
unbind C-b
set-option -g prefix C-Space
bind-key Space send-prefix
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
setw -g mode-keys vi
# For vim plugin vim-tmux-clipboar
set -g focus-events on
set-option -sg escape-time 10
#Create panes
bind-key j split-window -h -c'#{pane_current_path}'
bind-key C-j split-window -h -c'#{pane_current_path}'
bind-key l split-window -c'#{pane_current_path}'
bind-key C-l split-window -c'#{pane_current_path}'
#####################
# 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
# Move windows
bind-key -r < swap-window -t -1
bind-key -r > swap-window -t +1
# and now unbind keys;
unbind Down
unbind Up
unbind Left
unbind Right
bind-key -n M-k switch-client -p
bind-key -n M-j switch-client -n
bind-key -n M-h previous-window
bind-key -n M-l next-window
bind-key -n M-0 select-window -t 0
bind-key -n M-1 select-window -t 1
bind-key -n M-2 select-window -t 2
bind-key -n M-3 select-window -t 3
bind-key -n M-4 select-window -t 4
bind-key -n M-5 select-window -t 5
bind-key -n M-6 select-window -t 6
bind-key -n M-7 select-window -t 7
bind-key -n M-8 select-window -t 8
bind-key -n M-9 select-window -t 9
# Shotcuts to windows and sessions
unbind-key i
bind-key i run-shell "tmux switch-client -t dev; tmux select-window -t nvim"
bind-key o run-shell "tmux switch-client -t dev; tmux select-window -t log"
bind-key h run-shell "tmux switch-client -t htop"
# Enter copy mode
bind-key -T prefix Space copy-mode
bind-key -T prefix C-Space copy-mode
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
bind -T copy-mode-vi Y send-keys -X copy-pipe 'xclip -in -selection clipboard'
bind -T copy-mode-vi i send-keys -X cancel
# Plugins
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @continuum-restore 'on'
set -g @plugin 'joshmedeski/t-smart-tmux-session-manager' #https://github.com/joshmedeski/t-smart-tmux-session-manager
# kill session
bind-key k run-shell -b "/home/inaki/.tmux/plugins/tmux-fzf/scripts/session.sh kill"
# switch to session FZF
unbind-key s
bind-key s run-shell -b "/home/inaki/.tmux/plugins/tmux-fzf/scripts/session.sh attach"
bind-key S choose-tree -Zs
# Exit from qemu
bind-key ñ send-keys C-a x
# Exit from picocom
bind-key Ñ send-keys C-a C-q
# FZF in tmux
set -g @plugin 'sainnhe/tmux-fzf'
TMUX_FZF_LAUNCH_KEY="C-f"
set -g default-terminal "tmux-256color"
set -ga terminal-overrides ",*256col*:Tc"
#set inactive/active window styles
#set -g window-active-style 'fg=default,bg=colour233'
#set -g window-style fg=default,bg=colour237
set -g window-active-style "fg=colour15,bg=default"
set -g window-style "fg=colour248,bg=default"
#pane border
setw -g pane-border-style fg=#31748f
setw -g pane-active-border-style fg=#eb6f92
#status bar configuration
setw -g status-style fg=colour233,bg=colour74
setw -g window-status-style fg=colour233,bg=colour74
setw -g window-status-current-style fg=colour74,bg=colour233
# ------------------- Plugins -------------------
# easymotion in copy mode
set -g @plugin 'schasse/tmux-jump'
set -g @jump-key 'u'
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'