-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
101 lines (77 loc) · 3.58 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
# this should be tmux-256color but for some reason it will brake italics and
# will show error "WARNING: terminal is not fully functional"
set-option -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ',xterm-256color:RGB'
# enable mouse support
set-option -g mouse on
# Open new window and pane in current directory
unbind-key c
bind-key c new-window -c "#{pane_current_path}"
unbind-key %
bind-key % split-window -h -c "#{pane_current_path}"
unbind-key '"'
bind-key '"' split-window -c "#{pane_current_path}"
# make window/pane index start with 1
set-option -g base-index 1
set-option -wg pane-base-index 1
# make esc delay shorter
# https://github.com/neovim/neovim/wiki/FAQ#esc-in-tmux-or-gnu-screen-is-delayed
set-option -sg escape-time 100
# Use vim keybindings in copy mode
set-option -wg mode-keys vi
set-option -g status-keys vi
set-option -g history-limit 10000
set-option -g status-interval 1
# Instead of detaching, switch to next active session
set-option -g detach-on-destroy off
# enter search
# https://github.com/tmux/tmux/issues/902
# bind key to multiple commands
# http://superuser.com/questions/352117/binding-a-tmux-key-to-multiple-commands
bind-key / copy-mode\; command-prompt -i -p "(search up)" "send-keys -X search-backward-incremental '%%%'"
# vim like copy and paste
# unbind previous-window
unbind-key p
# unbind original paste
unbind-key ]
bind-key p paste-buffer
# rebind begin-selection
unbind-key -T copy-mode-vi Space
bind-key -T copy-mode-vi v send-keys -X begin-selection
# rebind copy-selection
unbind-key -T copy-mode-vi C-j
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi y send-keys -X copy-selection
bind-key -T copy-mode-vi M-y send-keys -X copy-selection-and-cancel
bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-selection
bind-key -T copy-mode-vi M-MouseDrag1Pane select-pane \; send-keys -X begin-selection
bind-key -T copy-mode-vi M-MouseDragEnd1Pane send-keys -X copy-selection-and-cancel
# TODO: setenv var so that when entering from regular mousedrag from root we could cancel copy mode by default
bind-key -T root M-MouseDrag1Pane if-shell -F -t = "#{mouse_any_flag}" 'if-shell -F -t= "#{pane_in_mode}" "copy-mode -M" "send-keys -M"' "copy-mode -M"
# TODO: make MouseDrag3Pane (middle button) to automatically copy to system clipboard
bind-key -T copy-mode-vi Y send-keys -X copy-pipe "pbcopy"
bind-key -T copy-mode-vi M-Y send-keys -X copy-pipe-and-cancel "pbcopy"
bind-key P run-shell "pbpaste | tmux load-buffer - && tmux paste-buffer"
bind-key Y run-shell "tmux save-buffer - | pbcopy"
# Theme
set-option -g status-left-length 16
set-option -g '@peacock:hooks:session-style' "${XDG_CONFIG_HOME}/tmux/hooks/set_session_style.sh"
set-option -g '@peacock:hooks:window-style' "${XDG_CONFIG_HOME}/tmux/hooks/set_window_style.sh"
# Plugins
# for roxma/vim-tmux-clipboard
set-option -g focus-events on
set-option -g @plugin 'tmux-plugins/tpm'
# for some reason this breaks peacock need further research
set-option -g @plugin 'imomaliev/tmux-prefix-highlight'
# set session scope
set-option -g '@prefix_highlight_option_scope' '-'
set-option -g @plugin 'imomaliev/tmux-keyboard-layout'
# set session scope
set-option -g '@keyboard_layout:option_scope' '-'
set-option -g '@keyboard_layout:length' 2
set-option -g @plugin 'imomaliev/tmux-peacock'
# https://github.com/tmux-plugins/tpm/blob/master/docs/changing_plugins_install_dir.md
set-environment -g TMUX_PLUGIN_MANAGER_PATH "$XDG_DATA_HOME/tmux/plugins"
# TODO: make this work with run-shell -b
run-shell "$XDG_DATA_HOME/tmux/plugins/tpm/tpm"