.tmux.conf 5.38 KB
Newer Older
1 2
set -g default-terminal "screen-256color"

3 4 5
set -g default-shell $SHELL 
set -g default-command "reattach-to-user-namespace -l ${SHELL}"

Ariejan de Vroom's avatar
Ariejan de Vroom committed
6 7
# Remap prefix to ctrl-a (or caps-a for my mac)
set -g prefix C-a
Ariejan de Vroom's avatar
Ariejan de Vroom committed
8 9

# Unbind Ctrl-b for use elsewhere
Ariejan de Vroom's avatar
Ariejan de Vroom committed
10 11 12 13 14 15 16 17 18
unbind C-b

# Default delay
set -sg escape-time 1

# 1-based window and panes
set -g base-index 1
set -g pane-base-index 1

19 20 21
# Works in iTerm
set -g mouse on

Ariejan de Vroom's avatar
Ariejan de Vroom committed
22 23 24 25 26 27 28
# Reload configuration
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"

# Allow sending of C-a to apps (just press C-a twice)
bind C-a send-prefix

# Splitting panes
Ariejan de Vroom's avatar
Ariejan de Vroom committed
29
unbind %
Ariejan de Vroom's avatar
Ariejan de Vroom committed
30
bind | split-window -h
31
bind _ split-window -v
Ariejan de Vroom's avatar
Ariejan de Vroom committed
32

Ariejan de Vroom's avatar
Ariejan de Vroom committed
33 34 35
# Don't wait for a meta key when hitting escape (for vim)
set-option -s escape-time 0

Ariejan de Vroom's avatar
Ariejan de Vroom committed
36 37
# Smart pane switching with awareness of vim splits
# See: https://github.com/christoomey/vim-tmux-navigator
38 39 40 41 42 43
is_vim='echo "#{pane_current_command}" | grep -iqE "(^|\/)g?(view|n?vim?)(diff)?$"'
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
Ariejan de Vroom's avatar
Ariejan de Vroom committed
44

45 46 47 48 49 50
# Easy vim-style pane navigation
# bind -n -r C-h select-pane -L
# bind -n -r C-j select-pane -D
# bind -n -r C-k select-pane -U
# bind -n -r C-l select-pane -R
# 
51
# Easy window switching
52 53
bind -n -r M-h select-window -t :-
bind -n -r M-l select-window -t :+
Ariejan de Vroom's avatar
Ariejan de Vroom committed
54

Ariejan de Vroom's avatar
Ariejan de Vroom committed
55 56 57 58 59
# Resize
bind -r + resize-pane -U
bind -r - resize-pane -D
bind -r < resize-pane -L
bind -r > resize-pane -R
Ariejan de Vroom's avatar
Ariejan de Vroom committed
60

Ariejan de Vroom's avatar
Ariejan de Vroom committed
61 62
# Vim style navigation in copy mode
setw -g mode-keys vi
Ariejan de Vroom's avatar
Ariejan de Vroom committed
63

64
# Setup 'v' to begin selection as in Vim
65
bind-key -t vi-copy v begin-selection
66
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
67

68
# Update default binding of `Enter` to also use copy-pipe
69
unbind -t vi-copy Enter
70
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
71 72

# Bind ']' to use pbbaste
73 74
bind ] run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"

75

Ariejan de Vroom's avatar
Ariejan de Vroom committed
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 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
# # fiddle with colors of status bar
# set -g status-bg colour4
# set -g status-fg colour234
# 
# # fiddle with colors of inactive windows
# setw -g window-status-bg colour4
# setw -g window-status-fg colour234
# setw -g window-status-attr dim
# 
# # change color of active window
# setw -g window-status-current-fg colour234
# setw -g window-status-current-bg colour3
# setw -g window-status-current-attr bright
# 
# # set color of regular and active panes
# set -g pane-border-fg colour234
# set -g pane-border-bg default
# set -g pane-active-border-fg blue
# set -g pane-active-border-bg default
# 
# # set color of command line
# set -g message-fg white
# set -g message-bg colour22
# set -g message-attr bright
# 
# #  configure contents of status bar
# set -g status-left-length 40
# set -g status-left "#[fg=black]\"#S\" "
# 
# set -g status-right "#[fg=black] #h | %d %b %R"
# 
# setw -g monitor-activity on
# set -g visual-activity on


## COLORSCHEME: gruvbox dark
set-option -g status "on"

# default statusbar colors
set-option -g status-bg colour237 #bg1
set-option -g status-fg colour223 #fg1

# default window title colors
set-window-option -g window-status-bg colour214 #yellow
set-window-option -g window-status-fg colour237 #bg1

set-window-option -g window-status-activity-bg colour237 #bg1
set-window-option -g window-status-activity-fg colour248 #fg3

# active window title colors
set-window-option -g window-status-current-bg default
set-window-option -g window-status-current-fg colour237 #bg1

# pane border
set-option -g pane-active-border-fg colour250 #fg2
set-option -g pane-border-fg colour237 #bg1

# message infos
set-option -g message-bg colour239 #bg2
set-option -g message-fg colour223 #fg1

# writting commands inactive
set-option -g message-command-bg colour239 #fg3
set-option -g message-command-fg colour223 #bg1

# pane number display
set-option -g display-panes-active-colour colour250 #fg2
set-option -g display-panes-colour colour237 #bg1

# clock
set-window-option -g clock-mode-colour colour109 #blue

# bell
set-window-option -g window-status-bell-style fg=colour235,bg=colour167 #bg, red


## Theme settings mixed with colors (unfortunately, but there is no cleaner way)
set-option -g status-attr "none"
set-option -g status-justify "left"
set-option -g status-left-attr "none"
set-option -g status-left-length "80"
set-option -g status-right-attr "none"
set-option -g status-right-length "80"
set-window-option -g window-status-activity-attr "none"
set-window-option -g window-status-attr "none"
set-window-option -g window-status-separator ""

set-option -g status-left "#[fg=colour248, bg=colour241] #S #[fg=colour241, bg=colour237, nobold, noitalics, nounderscore]"
set-option -g status-right "#[fg=colour239, bg=colour237, nobold, nounderscore, noitalics]#[fg=colour246,bg=colour239] %Y-%m-%d  %H:%M #[fg=colour248, bg=colour239, nobold, noitalics, nounderscore]#[fg=colour237, bg=colour248] #h "

set-window-option -g window-status-current-format "#[fg=colour239, bg=colour248, :nobold, noitalics, nounderscore]#[fg=colour239, bg=colour214] #I #[fg=colour239, bg=colour214, bold] #W #[fg=colour214, bg=colour237, nobold, noitalics, nounderscore]"
set-window-option -g window-status-format "#[fg=colour237,bg=colour239,noitalics]#[fg=colour223,bg=colour239] #I #[fg=colour223, bg=colour239] #W #[fg=colour239, bg=colour237, noitalics]"