summaryrefslogtreecommitdiff
path: root/.config/tmux/tmux.conf
blob: d81ee5f63ae219f41856c50766a08c4638737fdd (plain)
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
# Basic settings
set -a terminal-features 'tmux-256color:RGB'

# Start numbering at 1
set -g base-index 1
set -g renumber-windows on

# Status bar
# set -g status "on"
# set -g status-position top
# set -g status-justify absolute-centre
# set -g status-style "bg=default"
# set -g window-status-current-style "bg=white,fg=black,bold"
# set -g status-interval 5
# set -g status-left "#S"
# set -g status-right ""
set -g status-position top
set -g status-interval 5
set -g status-left-length 30
set -g status-right-length 50
set -g window-status-separator ""

# Theme
set -g status-style "bg=default,fg=default"
set -g status-left "#[fg=black,bg=blue,bold] #S #[bg=default] "
# set -g status-right "#[fg=blue]#{?client_prefix,PREFIX ,}#{?window_zoomed_flag,ZOOM ,}#[fg=brightblack]#h "
set -g status-right ""
set -g window-status-format "#[fg=brightblack] #I:#W "
set -g window-status-current-format "#[fg=blue,bold] #I:#W "
set -g pane-border-style "fg=brightblack"
set -g pane-active-border-style "fg=blue"
set -g message-style "bg=default,fg=blue"
set -g message-command-style "bg=default,fg=blue"
set -g mode-style "bg=blue,fg=black"
setw -g clock-mode-colour blue

# Change the default prefix to C-a
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix

# Split windows (opens in same directory as current window)
unbind %
unbind '"'
bind \\ split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
bind s split-window -v -c "#{pane_current_path}"

# Fast session switching
unbind-key s
bind -n M-s choose-tree -Zs # filtered session/window/tree view
bind -n M-S switch-client -l  # jump to last session instantly

# Alt+hjkl to switch panes w/o prefix
bind -n M-h select-pane -L
bind -n M-j select-pane -D
bind -n M-k select-pane -U
bind -n M-l select-pane -R

# Alt+number to switch windows
bind -n M-1 select-window -t 1
bind -n M-2 select-window -t 2
bind -n M-3 select-window -t 3
bind -n M-4 select-window -t 4
bind -n M-5 select-window -t 5
bind -n M-6 select-window -t 6
bind -n M-7 select-window -t 7
bind -n M-8 select-window -t 8
bind -n M-9 select-window -t 9

# Vim style copying
set-window-option -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind -T copy-mode-vi MouseDragEnd1Pane

bind-key x kill-pane    # Skip kill pane prompt
set -g detach-on-destroy off  # don't exit from tmux when closing a session

# Setting default shell to zsh
set-option -g default-shell /usr/bin/zsh

# reload config file with a keystroke
unbind r
bind r source-file ~/.config/tmux/tmux.conf

bind-key -n M-t run-shell "tmux neww ~/.local/bin/tmux-sessionizer"
bind-key -r M-h run-shell "tmux neww tmux-sessionizer -s 0"
bind-key -r M-j run-shell "tmux neww tmux-sessionizer -s 1"
bind-key -r M-k run-shell "tmux neww tmux-sessionizer -s 2"
bind-key -r M-l run-shell "tmux neww tmux-sessionizer -s 3"