-
Notifications
You must be signed in to change notification settings - Fork 3
/
tmux.conf
93 lines (69 loc) · 3.2 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
# ================ General Config ====================
# 256 color
set -g default-terminal "xterm-256color-italic"
# No escape time for vi mode
set -sg escape-time 0
# Set first window index to 1 (instead of 0)
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Navigate using Vim rather than Emacs (default)
setw -g mode-keys vi
# Ensure keyboard shortcuts inside vim still work
setw -g xterm-keys on
# Mouse support - set to on if you want to use the mouse
set -g mouse off
# Turn on focus-events for compatibility with Vim autoread
set -g focus-events on
# ================ Keybindings =======================
# Set Ctrl-a as the default prefix key combination, unbind Ctrl-b
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# Highlight and copy text to system clipboard
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 'reattach-to-user-namespace pbcopy'
# "The fix for tmux in macOS woes" (read: http://bit.ly/1HOk6o3)
set -g default-command "reattach-to-user-namespace -l /bin/zsh"
# Force reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Create splits and vertical splits
bind-key v split-window -p 50 -h -c "#{pane_current_path}"
bind-key s split-window -p 50 -c "#{pane_current_path}"
# Clear pane, similar to cmd-k in shell window
bind k send-keys -R \; clear-history
# 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"
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
# Pane resize in all four directions using vi bindings.
# Shift-<h,j,k,l> in iTerm.
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# ================ Status bar ========================
# Status
set -g status "on"
set -g status-style "bg=colour236,none"
# Status Left
set -g status-left ""
# Status Right
set -g status-right "#[fg=colour239,bg=colour236,nobold,nounderscore,noitalics]⮂#[fg=colour015,bg=colour239] %H:%M #[fg=colour220,bg=colour239]⮃#[fg=colour015,bg=colour239] %m-%d-%Y #[fg=colour087,bg=colour239]#[fg=colour220]"
# Pane
set -g pane-border-style "fg=colour253"
set -g pane-active-border-style "fg=colour220"
# Window Status
setw -g window-status-format "#[fg=colour244,bg=colour236] #I ⮁#[fg=colour244,bg=colour236] #W "
setw -g window-status-current-format "#[fg=colour220,bg=colour239] #I #[fg=colour220,bg=colour239]⮁#[fg=colour015,bg=colour239] #W #[fg=colour239,bg=colour236,nobold,nounderscore,noitalics]⮀"
setw -g window-status-separator ""
# ================ Local version =====================
if-shell "[ -f ~/.tmux_local.conf ]" 'source ~/.tmux_local.conf'