/
.tmux.conf
125 lines (99 loc) · 4.94 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
# Bindings {{{
# Remap prefix
unbind C-b
set -g prefix C-Space
# Quick key for moving back to the previous window
bind-key L last-window
# Vim style bindings for pane movement
bind-key -r h select-pane -L
bind-key -r j select-pane -D
bind-key -r k select-pane -U
bind-key -r l select-pane -R
# Fix issue with tmux repeating -r the arrow directions (meaning when you switch panes you can accidentally jump back to the other pane again)
bind-key Up select-pane -U
bind-key Down select-pane -D
bind-key Left select-pane -L
bind-key Right select-pane -R
# Make splitting windows easier
bind-key v split-window -h
bind-key s split-window -v
# Reload tmux config
# Same as in command mode :source-file ~/tmux.conf
# Or outside of tmux with `tmux source-file ~/tmux.conf`
bind-key r source-file ~/.tmux.conf
# Allow Ctrl+k to clear the history
bind-key -n C-k clear-history
# Make resizing panes easier
bind-key < resize-pane -L 5
bind-key > resize-pane -R 5
bind-key + resize-pane -U 5
bind-key - resize-pane -D 5
bind-key = select-layout even-vertical
bind-key | select-layout even-horizontal
# }}}
# Settings {{{
# Ensure terminal starts with its own colour scheme (defined below)
set -g default-terminal "screen-256color"
set-window-option -g utf8 on
# Note: if you have EDITOR=vim set
# then the following two settings aren't needed
# Use Vi style key bindings to move around command line mode
set-option -g status-keys vi
# Use Vi style key bindings to move around copy mode
setw -g mode-keys vi
# Remove delay when pressing esc in Vim
set -sg escape-time 0
# Fix issue with copying from within a tmux session and wanting to paste outside of it
set -g default-command "reattach-to-user-namespace -l '/bin/zsh'"
# Setup `v` and `y` operators to start and yank selections (like Vim)
bind-key -t vi-copy 'v' begin-selection
bind-key -t vi-copy 'y' copy-pipe "reattach-to-user-namespace pbcopy" # pbcopy is only available for Mac (not Linux)
# Prevent tmux from renaming the tab when processes change
# e.g. if you're in a directory which is a git repo and you fire up Pry then
# tmux would first rename the tab to 'java' (for Pry) then 'git' when exiting Pry, then finally back to 'zsh'
set-option -g allow-rename off
# Tells tmux up front what shell to expect
set-option -g default-shell /bin/zsh
# Set base to 1
set -g base-index 1
# Enable UTF-8 support in status bar
set -g status on
set -g status-utf8 on
# Increase scrollback lines
set -g history-limit 30000
# Renumber windows automatically after removing a window
# Prevents my OCD and means I don't have to manually run {move|swap}-window
set-option -g renumber-windows on
# Colour reference...
# Light Blue = 31
# Dark Grey = 234
# Light Grey = 240
# White = 254
# the ~/bin/battery bash script comes from https://github.com/richo/battery/
# don't forget to `chmod +x ~/bin/battery`
set -g status-right "#(~/bin/battery) #[fg=colour234,bg=white,nobold,nounderscore,noitalics]#[fg=colour250,bg=colour234] %a #[fg=colour247,bg=colour234] #[fg=colour247,bg=colour234] %b %d %R #[fg=colour252,bg=colour234,nobold,nounderscore,noitalics]#[fg=red,bg=colour234]#[fg=white,bg=red] #H" # sets right side of the status bar to look bit nicer
set -g status-bg white # sets status bar background colour
set -g status-justify 'left' # positions each window name to the left most edge of the status bar
set -g pane-border-fg white # sets default pane border colour
set -g pane-active-border-fg red # highlights border of current pane
set -g message-bg red # sets status bar background colour when executing a command via command-line mode
set -g message-fg white # sets colour of status bar font in command-line mode
setw -g window-status-separator ' ' # adds separator (in this case some extra breathing space around the list of windows)
setw -g window-status-current-format '#[fg=colour231,bg=colour31,bold] #I #W #[fg=colour31,bg=white,nobold,nounderscore,noitalics]' # sets design of current window listed in the status bar
# Explanation of settings I don't use...
#
# sets background colour of status bar when you try to ESC command-line mode:
# set -g message-command-bg 'colour31'
#
# sets colour of status bar font in default mode:
# setw -g window-status-fg black
#
# sets the background colour of the window listed in the status bar:
# setw -g window-status-bg 'colour234'
#
# sets default design around each window listed in the status bar:
# setw -g window-status-format '#[fg=colour234,bg=colour234,nobold,nounderscore,noitalics]#[default] #I #W #[fg=colour234,bg=colour234,nobold,nounderscore,noitalics]'
#
# sets left side information of status bar:
# set -g status-left '#[fg=colour16,bg=colour254,bold] #S #[fg=colour254,bg=colour240,nobold,nounderscore,noitalics]#[fg=colour237,bg=colour240] #F #[fg=colour240,bg=colour236,nobold,nounderscore,noitalics]#[fg=colour247,bg=colour236] #W #[fg=colour236,bg=colour234,nobold,nounderscore,noitalics]'
# }}}