-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.tmux.conf
More file actions
88 lines (68 loc) · 3.12 KB
/
.tmux.conf
File metadata and controls
88 lines (68 loc) · 3.12 KB
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
set -g prefix C-a
unbind C-b
bind C-a send prefix
# vim mappings
set -g status-keys vi
setw -g mode-keys vi
# set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# set color
set -g default-terminal "screen-256color" # support 256 colors for vim colorschemes
# split panes
bind \ split-window -h # split horizontal
bind - split-window -v # split vertical
# start windows at a base index of 1
set -g base-index 1
# reload tmux config
bind r source-file ~/.tmux.conf
# shift-arrow to switch windows
bind -n S-Left previous-window
bind -n S-Right next-window
# no delay for escape key press
set -sg escape-time 0
# resize panes
bind-key -n C-S-Up resize-pane -U 15
bind-key -n C-S-Down resize-pane -D 15
bind-key -n C-S-Left resize-pane -L 25
bind-key -n C-S-Right resize-pane -R 25
# mouse settings
set-option -g -q mouse on
# allow scrolling like before 2.1
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
# copy-paste integration
set-option -g default-command "login-shell"
# use vim key bindings in copy mode
setw -g mode-keys vi
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection
# use xclip on linux and pbcopy/paste on OSX
if-shell '[ $OSTYPE == "linux-gnu" ]' \
"\
unbind-key -T copy-mode-vi Enter; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'xclip -se c -i'; \
" "\
unbind-key -T copy-mode-vi Enter; \
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel 'reattach-to-user-namespace pbcopy'; \
bind ] run 'pbpaste | tmux load-buffer - && tmux paste-buffer'; \
"
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
# set color scheme
#source-file ~/.tmux-theme-badwolf
# list of plugins
#set -g @plugin 'tmux-plugins/tpm'
#set -g @plugin 'tmux-plugins/tmux-sensible'
#set -g @plugin 'tmux-plugins/tmux-resurrect'
#set -g @plugin 'tmux-plugins/tmux-continuum'
## init tmux plugin manager
#run '~/.tmux/plugins/tpm/tpm'