-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
119 lines (94 loc) · 3.81 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
# vim:fdm=marker
# Key bindings {{{
# Set prefix key
unbind-key C-b
set -g prefix C-Space
bind-key C-Space send-prefix
# Reload tmux configuration by hotkey Prefix r
bind-key R source-file ~/.tmux.conf \; display "Reloaded configuration"
# Make copy mode behaving more like vim.
# In the copy mode press:
# - v (instead of default Space) to begin selection.
# - V to toggle line selection.
# - C-v to toggle rectangular selection.
run-shell "tmux setenv -g TMUX_VERSION $(tmux -V | cut -c 6-)"
# bind-key syntax in Tmux versions < 2.4.
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.4" | bc)" = 1 ]' \
"bind-key -t vi-copy v begin-selection; \
bind-key -t vi-copy V select-line; \
bind-key -t vi-copy C-v rectangle-toggle; \
bind-key -t vi-copy y copy-selection"
# Newer versions (>= 2.4).
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.4" | bc)" = 1 ]' \
"bind-key -T copy-mode-vi v send -X begin-selection; \
bind-key -T copy-mode-vi V send -X select-line; \
bind-key -T copy-mode-vi C-v send -X rectangle-toggle; \
bind-key -T copy-mode-vi y send -X copy-selection-and-cancel'"
# Smart pane switching with awareness of vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|l?n?vim?x?)(diff)?$'"
bind -n M-h if-shell "$is_vim" "send-keys M-h" "select-pane -L"
bind -n M-j if-shell "$is_vim" "send-keys M-j" "select-pane -D"
bind -n M-k if-shell "$is_vim" "send-keys M-k" "select-pane -U"
bind -n M-l if-shell "$is_vim" "send-keys M-l" "select-pane -R"
bind -n M-\\ if-shell "$is_vim" "send-keys M-\\" "select-pane -l"
# }}}
# Options {{{
set-option -g default-shell $SHELL
#set-option -g default-command /bin/zsh
set-option -g default-terminal "screen-256color"
# fix hotkeys in zsh?
set-window-option -g xterm-keys on
# Set initial index of windows and panes to be 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# Set time in ms which Tmux waits for a keystroke after pressing <prefix>.
set-option -s escape-time 1
# Increase scrollback history limit.
set-option -g history-limit 10000
# Use the window size of the client that had the most recent activity.
set-option -g window-size latest
# Prevent programs from changing window names.
set-window-option -g allow-rename off
# Renumber windows automatically
set-option -g renumber-windows on
# Work with buffer in vi mode
set-window-option -g mode-keys vi
# Work with command line in Emacs mode
set-option -g status-keys emacs
set-option -g mouse on
# Pass events from terminal to applications inside tmux.
# Suggested by neovim's :checkhealth so that 'autoread' works.
set-option -g focus-events on
# Enable true colors in neovim.
set-option -sa terminal-features "xterm-256color:RGB"
# This options (available for tmux 2.9+) set window title.
set-option -g set-titles on
set-option -g set-titles-string '#S'
# }}}
# Status-line theme {{{
if-shell "uname | grep -q Darwin" \
"set -g @tmux-statusline-theme 'gruvbox-light-hard'"
if-shell "uname -a| grep -q Ubuntu" \
"set -g @tmux-statusline-theme 'gruvbox-light-hard'"
if-shell "[ $MY_COLOR_THEME = 'solarized-light' ]" \
"set -g @tmux-statusline-theme 'solarized-light'"
# }}}
# Plugins {{{
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @plugin 'tmux-plugins/tmux-pain-control'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'nhdaly/tmux-better-mouse-mode'
set -g @plugin 'dmitry-kabanov/tmux-statusline-themes'
# Settings for `tmux-continuum` plugin.
# Automatically start tmux when computer starts and restore
# the last saved environment.
set -g @continuum-boot 'on'
set -g @continuum-restore 'on'
set -g @continuum-boot-options 'iterm'
# Initialize tmux plugin manager
run-shell '~/.tmux/plugins/tpm/tpm'
# }}}