forked from sloria/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
executable file
·136 lines (104 loc) · 3.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Display things in 256 colors
set -g default-terminal "screen-256color"
set -g default-shell $SHELL
# set prefix key to space
unbind C-space
set -g prefix C-space
# Also assign Ctrl-space to send the prefix to a remote session
bind-key C-space send-prefix
# index windows at 1 instead of 0 (easier keyboard nav)
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows upon closing
set -g renumber-windows on
# inc history
set-option -g history-limit 10000
# Use vim keybindings
setw -g mode-keys vi
# reload tmux config
unbind r
bind r \
source-file ~/.tmux.conf \;\
display 'Reloaded tmux config.'
# create windows and panes in current directory
unbind '"'
bind '"' split-window -c "#{pane_current_path}"
unbind %
bind % split-window -h -c "#{pane_current_path}"
# map both c and C-c to avoid mistakes
unbind c
bind c new-window -c "#{pane_current_path}"
unbind C-c
bind C-c new-window -c "#{pane_current_path}"
# Choose session
unbind S
bind S choose-session
# Cycle windows with ctrl-shift left/right
unbind -n C-S-Left
bind-key -n C-S-Left select-window -t :-
unbind -n C-S-Right
bind-key -n C-S-Right select-window -t :+
# Move windows with Prefix-left/right
unbind Left
bind-key Left swap-window -t -1
unbind Right
bind-key Right swap-window -t +1
# Layouts
#########
# Tile all
bind = select-layout tiled
bind + select-layout main-horizontal
bind \; resize-pane -Z
# Mouse mode
############
set-option -g mouse on
# Navigate panes
################
# use vim-like keys for splits and windows
bind-key v split-window -h -c "#{pane_current_path}"
bind-key s split-window -v -c "#{pane_current_path}"
# Smart pane switching with awareness of vim splits
# https://github.com/christoomey/vim-tmux-navigator
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"
# Cycle through windows
bind l select-window -t :+
bind h select-window -t :-
# Alternate between last window
bind - last-window
# Closing panes, windows and sessions
#####################################
# Using w for closing, like in macOS
# close panes
unbind w
bind w kill-pane
# close window
unbind C-w
bind C-w kill-window
# close sessions with q
unbind q
bind q confirm kill-session
# Choose windows and sessions with tab
######################################
bind tab choose-window
# Make copy-n-paste work on macOS
#################################
# Setup 'v' to begin selection as in Vim
bind-key -Tcopy-mode-vi v send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "reattach-to-user-namespace pbcopy"
# Make vim yanking work with macOS system clipboard
set-option -g default-command "reattach-to-user-namespace -l ${SHELL}"
# pane number display
set-option -g display-panes-active-colour blue
set-option -g display-panes-colour brightred
# automatically rename window to current directory
# https://stackoverflow.com/a/45010147
set-option -g status-interval 5
set-option -g automatic-rename on
set-option -g automatic-rename-format '#{b:pane_current_path}'
# Plugins
#########