-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmuxconf
83 lines (71 loc) · 3.1 KB
/
tmuxconf
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
# fix delay escape time on neovim and tmux
set -sg escape-time 10
# start index from 1
set -g base-index 1
# remap prefix
unbind C-b
set-option -g prefix C-o
bind-key C-o send-prefix
# disable window renaming
set-option -g allow-rename off
# set option for status bar
set-option -g status on
set-option -g status-position top
set -g status-justify left #centre
# status bar refresh interval
set -g status-interval 5
# set scrollback buffer to 5000 default is 2000
set -g history-limit 5000
#customize status line
set -g status-fg colour246
set -g status-bg colour235
# set window list colors - yellow for active and cyan for inactive
set-window-option -g window-status-style fg=brightblue,bg=colour235
set-window-option -g window-status-current-style fg=colour11,bg=colour235,bright
# divider color
set -g pane-border-style fg=colour242
set -g pane-active-border-style fg=colour141,bg=default
# status right only show datetime
# set -g status-right '#(date)'
set -g status-right ' %A %d-%b-%y | #{battery_icon}#{battery_percentage}| #S |'
set -g status-right-length 60
set -g status-left-length 60
set -g status-left '🕧 %H:%M | #{=|-15|…;s|#(echo $HOME)|~|:pane_current_path} |#{spotify_playback} #{spotify_status_full} |'
# enable mouse mode
set -g mouse on
# 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
# split pane
bind-key v split-window -h -c "#{pane_current_path}"
bind-key h split-window -v -c "#{pane_current_path}"
# respawn pane (recreate pane's terminal session)
bind-key R respawn-pane -k
# create window in current path
bind c new-window -c "#{pane_current_path}"
bind '"' split-window -h -c "#{pane_current_path}"
bind '%' split-window -c "#{pane_current_path}"
# copy paste functionality (need test)
# xclip required (ubuntu via apt)
set-window-option -g mode-keys vi
set-option -g set-clipboard off
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -sel clip -i"
bind-key -T copy-mode-vi r send-keys -X rectangle-toggle
bind r source-file ~/.tmux.conf
run-shell ~/.tmux_plugins/tmux-plugin-spotify/spotify.tmux
run-shell ~/.tmux_plugins/tmux-battery/battery.tmux