-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
81 lines (60 loc) · 2.7 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
# Use C-a instead of C-b
set -g prefix C-a
# Vim it up
set-window-option -g mode-keys vi
set-window-option -g status-keys vi
## Setup 'v' to begin selection as in Vim
#bind-key -t vi-copy v begin-selection
#bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
#
## Update default binding of `Enter` to also use copy-pipe
#unbind -t vi-copy Enter
#bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
set-option -g default-command "reattach-to-user-namespace -l zsh"
# ZSH it up
set-option -g default-shell /bin/zsh
set -g default-command /bin/zsh
# Longer status left allows project/branch session names
set-option -g status-left-length 50
# Attempt to rename windows
set-option -g set-titles on
# Better default session colors
set-option -g status-fg colour234
set-option -g status-bg colour6
# Status line options
set -g status-right '#(date +"%A, %B %d [%H:%M]")'
# Support colorz
set-option -g default-terminal "screen-256color"
# First window is 1
set -g base-index 1
set -g pane-base-index 1
# Open splits with logical/mnemonic shortcuts
unbind %
bind \\ split-window -h
bind - split-window -v
# hjkl to move between panes
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 b set-option -g status-left-bg colour6
# Misc
bind-key C-a last-window # C-a C-a jumps back
bind-key C-s choose-session # s does it, I often accidentally C-a C-s because my finger's still on ctrl
bind-key ` send-keys '`'
# tmux-vim navigation
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)g?(view|n?vim?)(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# nvim trickery
set -g escape-time 20
bind-key C-l send-keys 'C-l'
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe "reattach-to-user-namespace pbcopy"
# Mouse niceness
set -g mouse on