-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
134 lines (107 loc) · 4.17 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
# improve colors
set -g default-terminal 'screen-256color'
# act like vim
setw -g mode-keys vi
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
bind-key -r C-h select-window -t :-
bind-key -r C-l select-window -t :+
# act like GNU screen
unbind C-b
set -g prefix C-a
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
set-window-option -g pane-base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# increase scrollback lines
set -g history-limit 10000
# switch to last pane
bind-key C-a last-pane
# Status Bar ---------------------
#
set -g status on
set -g status-utf8 on
# soften status bar colors
set -g status-bg '#586e75'
set -g status-fg '#eee8d5'
# More colors from Solarized
# $base03: #002b36;
# $base02: #073642;
# $base01: #586e75;
# $base00: #657b83;
# $base0: #839496;
# $base1: #93a1a1;
# $base2: #eee8d5;
# $base3: #fdf6e3;
# $yellow: #b58900;
# $orange: #cb4b16;
# $red: #dc322f;
# $magenta: #d33682;
# $violet: #6c71c4;
# $blue: #268bd2;
# $cyan: #2aa198;
# $green: #859900;
# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right ''
set -g status-justify centre
set-option -g status-left-length 50
set-option -g status-right "Battery: #{battery_icon} #{battery_percentage} #{battery_remain} | #(date '+%a, %b %d - %I:%M')"
set -g status-left "Session: #S"
#Allow mouse usage
set -g mouse on
# Shift + arrows to resize pane
bind -n S-Left resize-pane -L 2
bind -n S-Right resize-pane -R 2
bind -n S-Down resize-pane -D 1
bind -n S-Up resize-pane -U 1
# smart pane switching with awareness of vim splits
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"
#vi style selection and copying to clipboard
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
#copy paste to clipboard
#set-option -g default-command "reattach-to-user-namespace -l zsh" # or bash...
#bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
#bind C-v run "reattach-to-user-namespace pbpaste | tmux load-buffer - && tmux paste-buffer"
bind-key r source-file ~/.tmux.conf \; display-message "~/.tmux.conf reloaded"
bind-key h split-window -v -c '#{pane_current_path}'
bind-key v split-window -h -c '#{pane_current_path}'
bind-key c new-window -c '#{pane_current_path}'
bind-key k confirm kill-window
# Quickly edit todo list
bind-key t split-window -h "vim"
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session'
# List of plugins
set -g @plugin 'tmux-plugins/tpm' # Tmux package manager
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-open' # Open highlighted selection directly from Tmux
set -g @plugin 'tmux-plugins/tmux-resurrect' # Restore previous sessions on reboot
set -g @plugin 'tmux-plugins/tmux-continuum' # Restore previous sessions on reboot
set -g @plugin 'tmux-plugins/tmux-battery' #Show battery icon/status
# Tmux will auto-start on system boot
set -g @continuum-boot 'on'
set -g @continuum-boot-options 'iterm'
set -g @continuum-restore 'on'
set -g @continuum-save-interval '5'
set -g @resurrect-strategy-vim 'session'
set -g @resurrect-strategy-nvim 'session' #for Neo Vim
# How to install other plugins from Github:
# To install new plugins press: prefix + I
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin '[email protected]/user/plugin'
# set -g @plugin '[email protected]/user/plugin'
# Initializes Tmux plugin manager.
# Keep this line at the very bottom of tmux.conf.
run-shell '~/.tmux/plugins/tpm/tpm'