-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
104 lines (79 loc) · 3.66 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
#--------------------------------------------------------------------------
# Configuration
#--------------------------------------------------------------------------
# Use Vi mode
setw -g mode-keys vi
# Increase scrollback buffer size
set -g history-limit 25000
# Start window and pane numbering from 1 for easier switching
set -g base-index 1
setw -g pane-base-index 1
# Allow automatic renaming of windows
set -g allow-rename off
set -g automatic-rename off
setw -g automatic-rename off
# Renumber windows when one is removed.
set -g renumber-windows on
# Improve colors
set -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ',xterm-256color:RGB'
# Allow the mouse to resize windows and select tabs
set -g mouse on
# Monitor window activity to display in the status bar
setw -g monitor-activity off
# Don't show distracting notifications
set -g bell-action none
set -g visual-bell off
set -g visual-activity off
set -g visual-silence off
# Focus events enabled for terminals that support them
set -g focus-events on
# Useful when using sharing a session with different size terminals
setw -g aggressive-resize on
# For neovim
set -sg escape-time 10
#--------------------------------------------------------------------------
# Key Bindings
#--------------------------------------------------------------------------
# -r means that the bind can repeat without entering prefix again
# -n means that the bind doesn't use the prefix
# 'PREFIX r' to reload of the config file
bind-key -r r source-file ~/.tmux.conf
# Keep current tab directory
bind-key c new-window -c "#{pane_current_path}"
# Switch between previous and next windows with repeatable
bind -r n next-window
bind -r p previous-window
# Move the current window to the next or previous window position and switch to it
bind -r N run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) + 1) && tmux select-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) + 1)"
bind -r P run-shell "tmux swap-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) - 1) && tmux select-window -t $(expr $(tmux list-windows | grep \"(active)\" | cut -d \":\" -f 1) - 1)"
# Move around panes like in vim
bind -r h select-pane -L
bind -r j select-pane -D
bind -r k select-pane -U
bind -r l select-pane -R
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# 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"
# allow to copy to system clipboard
bind-key y run -b "tmux show-buffer | xclip -selection clipboard"\; display-message "copied tmux buffer to system clipboard"
# Splitting
bind '"' split-window -h -c "#{pane_current_path}"
bind '%' split-window -v -c "#{pane_current_path}"
#--------------------------------------------------------------------------
# Status line
#--------------------------------------------------------------------------
# Status line customisation
set-option -g status-left-length 100
set-option -g status-left " #{session_name} "
set -g status-right '#h'
set-option -g window-status-format "#{window_index}:#{window_name}#{window_flags} "
set-option -g window-status-current-format "#{window_index}:#{window_name}#{window_flags} "
set-option -g window-status-current-style "fg=#dcc7a0"
set-option -g window-status-activity-style none
set-option -g status-style "fg=#7C7D83 bg=default"