-
Notifications
You must be signed in to change notification settings - Fork 1
/
.tmux.conf
62 lines (51 loc) · 2.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
set-option -g history-limit 3000
# make tmux display things in 256 colors
set -g default-terminal "screen-256color"
source ~/dotfiles/tmux/cromwell.theme
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# #H = Hostname of local host
# #h = Hostname of local host without the domain name
# #F = Current window flag
# #I = Current window index
# #D = Current pane unique identifier
# #P = Current pane index
# #S = Session name
# #T = Current pane title
# #W = Current window name
# ## = A literal `#'
set -g set-titles-string "#S #W"
set -g set-titles on
################################################################
# Key bindings
################################################################
unbind C-d
set -g prefix C-d
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
# fixing tmux and pastebuffers (clipboards)
set-option -g default-command "reattach-to-user-namespace -l zsh"
bind C-c run "tmux show-buffer | reattach-to-user-namespace pbcopy"
bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
# Switch to specific pane (1 indexed)
bind -n C-1 select-pane -t 1
bind -n C-2 select-pane -t 2
bind -n C-3 select-pane -t 3
bind -n C-4 select-pane -t 4
# Create splits
bind j split-window -v -c '#{pane_current_path}'
bind l split-window -h -c '#{pane_current_path}'
# Resize panes
# Note: In iterm2 -> preferences -> keys set L/R Option as +Esc
bind -n M-h resize-pane -L 5;
bind -n M-l resize-pane -R 5;
bind -n M-k resize-pane -U 5;
bind -n M-j resize-pane -D 5;
# Move Windows
bind -n S-Left swap-window -t -1
bind -n S-Right swap-window -t +1
# New Windows with Current path
bind c new-window -c "#{pane_current_path}"
# Smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"