-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
75 lines (59 loc) · 3 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
set -g default-terminal "screen-256color"
# the location of `zsh` is different for different OSs
if-shell "uname | grep -q Linux" "set-option -g default-shell /usr/bin/zsh" "set-option -g default-shell /usr/local/bin/zsh"
set-window-option -g mouse on
# if you're using iTerm in OSX, option+click will still select text
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'copy-mode -e'"
### unbindings ###
unbind : # unbind the colon, so I can use it in screen
unbind '"' # unbind horizontal split
unbind % # unbind vertical split
unbind n # unbind view-next-window
unbind i # unbind info
bind-key Escape command-prompt # bind escape to command-prompt
bind-key - split-window -v # split pane horizontally
bind-key | split-window -h # split pane vertically
bind-key n new-window
#remap the default command prefix. Only on OSX. Leave the default C-a on other hosts.
if-shell "uname | grep -q Darwin" "set-option -g prefix C-a; unbind-key C-b; bind-key C-a send-prefix; set-option -g xterm-keys on" ""
# Use Alt-arrow keys without prefix key to switch panes.
# Except left/right. I like the skip word keystroke too much.
unbind-key M-Left
unbind-key M-right
bind -n M-Up select-pane -U
bind -n M-Down select-pane -D
# Shift arrow to switch windows
if-shell "uname | grep -q Darwin" "bind -n S-Left previous-window" "bind -n C-Left previous-window"
if-shell "uname | grep -q Darwin" "bind -n S-Right next-window" "bind -n C-Right next-window"
# Reload tmux config
bind r source-file ~/.tmux.conf \; display-message "Config reloaded."
# one day, figure out how to collapse everything pre "~" into a "~". The below may come in handy, but is zsh-only
# echo -n -e "${PWD/${HOME}/~}"
set -g window-status-format '#{pane_current_command}|#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
set -g window-status-current-format '#(pwd="#{pane_current_path}"; echo ${pwd####*/})#F'
set-option -g status-interval 1
set-option -g history-limit 10000
### theme ####
set -g status-bg black
set -g status-fg white
set -g window-status-current-style fg=black,bg=white,bold
set -g status-interval 1
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)'
# load averages are sourced differently in darwin than linux
if-shell "uname | grep -q Darwin" \
"set -g status-right '#[fg=yellow]#(sysctl -n vm.loadavg | cut -d \" \" -f 2-4)#[default] #[fg=white]%H:%M#[default]'" \
"set -g status-right '#[fg=yellow]#(cut -d \" \" -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'"
######## cheatsheet #######
# ctrl-a + - horizontal split into top and bottom
# ctrl-a + | vertical split into left and right
# ctrl-a + $ rename current session (set of windows)
# ctrl-a + & kill current window
# ctrl-a + , rename current window
# ctrl-a + 0-9 select a window 0 to 9
# ctrl + left go to previous pane
# ctrl-a + d detach current client
# ctrl-a + f find in current windows
# shift + left go to previous window
# ctrl-a + x kill current pane
# ctrl-o rotate to other panes