-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
119 lines (92 loc) · 3.9 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
# setup colors and default shell
# set -g default-terminal "screen-256color"
# Add truecolor support
# set-option -ga terminal-overrides ",xterm-256color:Tc"
# Default terminal is 256 colors
# set -g default-terminal "screen-256color"
set -g default-terminal "tmux-256color"
set-option -sa terminal-overrides ',xterm*:RGB'
set-option -ga terminal-overrides ',xterm*:Tc'
# enable mouse navigation and resize panes
set -g mouse on
# Hack for neovim ESC
set-option -sg escape-time 10
set-option -g allow-rename off
set -g base-index 1
set-window-option -g pane-base-index 1
set-option -sg focus-events off
set-option -sg status-interval 1
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
# remaping C-b to C-a
# unbind C-b
# set -g prefix C-a
bind-key C-o rotate-window
# new window in workspace
bind c new-window -c '#{pane_current_path}'
# split panes using | and -
bind / split-window -h -c '#{pane_current_path}'
bind - split-window -v -c '#{pane_current_path}'
bind-key v split-window -h -c '#{pane_current_path}'
bind-key s split-window -v -c '#{pane_current_path}'
bind-key enter next-layout
bind-key + select-layout main-horizontal
bind-key = select-layout main-vertical
bind-key S-Left swap-window -t -1
bind-key S-Right swap-window -t +1
bind-key J resize-pane -D 5
bind-key K resize-pane -U 5
bind-key H resize-pane -L 5
bind-key L resize-pane -R 5
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
# bind a reload key
bind r source-file ~/.tmux.conf \; display-message "Config reloaded.."
# perform bind C-l to `clear` the screen
bind C-l send-keys 'C-l'
bind C-h send-keys 'C-h'
bind -n M-n run-shell -b 'alacritty --working-directory #{pane_current_path} -e tmux'
# free C-v for vim's v-block
# bind-key -T copy-mode-vi C-v
# renumber windows sequentially after closing any of them
set -g renumber-windows on
# start selecting text typing 'v' key (once you are in copy mode)
bind-key -T copy-mode-vi 'v' send -X begin-selection
# copy selected text to the system's clipboard
# bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "pbcopy"
# VIM mode
# Use vim keybindings in copy mode
setw -g mode-keys vi
bind-key -T copy-mode-vi 'v' send -X begin-selection # Begin selection in copy mode.
bind-key -T copy-mode-vi 'C-v' send -X rectangle-toggle # Begin selection in copy mode.
bind-key -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "xclip -i -selection clipboard"
# Update default binding of `Enter` to also use copy-pipe
unbind -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send -X copy-pipe-and-cancel "xclip -i -selection clipboard"
# 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|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
# status bar personalizations
# default statusbar colors
# set-option -g status-bg white
# set-option -g status-fg yellow
# pane number display
set-option -g display-panes-active-colour blue
set-option -g display-panes-colour brightred
set -g status-bg '#505050'
set -g status-bg colour0
set -g pane-active-border-style 'bg=black fg=#B26818'
set -g pane-border-format 'bg=black fg=#505050'
set -g status-left '#[bg=brightwhite,fg=black] #(cd #{pane_current_path}; git rev-parse --abbrev-ref HEAD) '
set -g status-right '#[bg=black,fg=brightwhite]'
set-option -g status-left-length 50
set-option -g status-right-length 100
set -g window-status-current-format '#[bg=yellow, fg=black] #W '
set -g window-status-format '#[bg=black, fg=brightwhite] #W(#I)'