/
tmux.conf
82 lines (65 loc) · 2.62 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
# set to the correct terminal (needed for vim to display correct color)
set -g default-terminal "screen-256color"
# increase tmux history
set -g history-limit 10000
# Change the prefix from ctrl-b to ctrl-a
unbind C-b
set -g prefix C-a
# send signal to nested tmux session by C-a, C-a,
bind C-a send-prefix
# force a reload of the config file
unbind r
bind r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded..."
# kill and respawn pane
unbind R
bind R respawn-pane -k
# enable mouse support particularly for scrolling
set -g mouse on
# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# Set status bar
set -g status-bg black
set -g status-fg white
set -g status-left '#[fg=green]#S'
set -g status-right '#[fg=yellow]#(uptime | egrep -o "[0-9]+ users?, +load.*"|perl -pe "s| averages?||"), %H:%M'
set -g status-right-length 40
# Highlight active window
set-window-option -g window-status-current-bg red
# Automatically set window title
set-window-option -g automatic-rename on
# Smart pane switching with awareness of vim splits
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"
# re-number windows when one is closed
set -g renumber-windows on
# Force tmux to number windows like panes, from 1 instead of 0
set -g base-index 1
# Create new window in current directory
bind '"' split-window -c "#{pane_current_path}"
bind % split-window -h -c "#{pane_current_path}"
bind c new-window -c "#{pane_current_path}"
# Move tmux windows like a pro.
# Credits to http://genkisugimoto.com/blog/move-your-tmux-windows-like-a-pro/
bind-key -r H run-shell 'tmux-win-move left'
bind-key -r L run-shell 'tmux-win-move right'
# Zoom easily with ctrl-space
bind -n C-Space resize-pane -Z
# tell tmux to use the system clipboard
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'V' send -X select-line
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# If using iTerm2, add a new keybinding for cmd-k with
# "Send Hex Code" = "0x01 0x6b 0x0a".
bind k send-keys -R \; clear-history