summaryrefslogtreecommitdiff
path: root/config/common/tmux/tmux.conf
blob: 409ad66967ab076aa0b50e6bec620b093f96fb20 (plain)
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
# By Nicholas Marriott. Public domain.
# but -now- me.

# Some tweaks to the status line
set -g status-right "%H:%M"
set -g window-status-current-style "underscore"
# Enable RGB color if running in xterm
set-option -sa terminal-overrides ",xterm*:Tc"
# Change the default $TERM to xterm-256color
# Necessary because vim ctrl arrows must be defined through TERM
set -g default-terminal "xterm-256color"
set-window-option -g xterm-keys on
# No bells at all
set -g bell-action none
# Keep windows around after they exit
set -g remain-on-exit off
# More history lines
set -g history-limit 16384
# Base window is Numero Uno
set -g base-index 1
set-window-option -g pane-base-index 1
# Set vi mode when copying
set-window-option -g mode-keys vi
# compatibility with vim for focus based events
set -g focus-events on

# KEYBINDINGS 
# Reload config file
bind r source-file ~/.tmux.conf \; display "Reloaded ~/.tmux.conf"
# Clipboard
bind -T copy-mode-vi v send-keys -X begin-selection
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -r -selection clipboard"
bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "xclip -r -selection clipboard"
# Unbind ESC
set -sg escape-time 0
# Toggle status bar
bind t set-option status
# Toggle monitoring window activity
bind m set monitor-activity\; display 'monitor-activity #{?monitor-activity,on,off}'
bind M run-shell "tmux set monitor-silence #{?monitor-silence,0,10}"\; display "monitor-silence #{?monitor-silence,on,off}"
# Toggle synchronized panes (sending keys to every pane)
bind y set synchronize-panes\; display 'synchronize-panes #{?synchronize-panes,on,off}'
# Paste from tmux buffer
bind p paste-buffer
# Kill all windows
bind  x     confirm -p "Kill Pane?"     kill-pane
bind  X     confirm -p "Kill Window?"   kill-window
bind  M-x   confirm -p "Kill Session?"  kill-session
bind  M-X   confirm -p "Kill Server?"   kill-server
# Restart pane
bind k run -C "respawn-pane -k; send-keys !! 'C-j'"
# Splitting
bind v split-window -h -c "#{pane_current_path}"
bind h split-window -v -c "#{pane_current_path}"
# Swapping left and right a la vim
bind -n M-H swap-pane -U
bind -n M-L swap-pane -D
## Resizing panes
bind -r C-H  resize-pane -L 5
bind -r C-J  resize-pane -D 5
bind -r C-K  resize-pane -U 5
bind -r C-L  resize-pane -R 5
# Join and break windows
bind j command-prompt -1p "Take window:" "join-pane -s %%"
bind J command-prompt -1p "Send to window:" "join-pane -t \:%% ; select-window -l"
# Break pane without losing focus
bind b break-pane -t :
# Reset length and shit
bind z select-layout main-vertical
# Pane navigating with h|j|k|l a la vim
bind -n -N "select leftwards pane"  M-h select-pane -L
bind -n -N "select downwards pane"  M-j select-pane -D
bind -n -N "select upwards pane"    M-k select-pane -U
bind -n -N "select rightwards pane" M-l select-pane -R
# Window navigating with M-u|i
bind -n M-u previous-window
bind -n M-i next-window
# Session navigeting with S-M-u|i
bind -n M-U switch-client -p
bind -n M-I switch-client -n
# Renaming
bind n command-prompt "rename-window '%%'"
bind N command-prompt "rename-session '%%'"
# Starting new windows
bind w new-window -c "#{pane_current_path}"
bind W new-session -c "$HOME"
# Show tree 
bind S choose-tree -Z
# Menu for mounting and ejecting devices.
bind E display-menu -T "#[align=centre]#I:#W" -x W -y W '' Mount 0 "display-popup -E 'amount'"