-
Notifications
You must be signed in to change notification settings - Fork 0
/
dot.tmux.conf
157 lines (118 loc) · 4.97 KB
/
dot.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
# ================================================================ info ===== #
# ----------------------------------------------------------- reference ----- #
# https://superuser.com/questions/1425920/different-between-set-g-and-setw-g-and-set
# --------------------------------------------------------------- setup ----- #
# cp -i dot.tmux.conf ~/.tmux.conf
# ======================================================= configuration ===== #
# to reload tmux you will need to exit tmux and launch tmux again for
# configuration to be active. bind key settings stack, so close terminal as
# well
# set default shell (uncomment after installing of custom shell)
# mac intel uses /usr/local
# mac m1 uses /opt/homebrew
# linux brew uses /home/linuxbrew/.linuxbrew
# set -g default-shell /bin/bash # system bash
# set -g default-shell /usr/local/bin/bash # brew mac intel
# set -g default-shell /opt/homebrew/bin/bash # brew mac m1
# set -g default-shell /home/linuxbrew/.linuxbrew/bin/bash # brew linuxbrew
# 0 is too far
set -g base-index 1
# fix vim color issue by enforcing $term color value
set -g default-terminal "screen-256color"
# enable copy mode like vim
setw -g mode-keys vi
# https://unix.stackexchange.com/questions/412605/tmux-command-mode-use-vi-shortcuts
# allow vim like command modes "ctrl-b :"
set -g status-keys vi
# increase limit of scroll
set -g history-limit 20000
# allow mouse to select pane
setw -g mouse on
# monitor activities in other windows
setw -g monitor-activity on
set -g visual-activity on
# enable copy
tmux_conf_copy_to_os_clipboard=true
# no delay for escape key press
set -sg escape-time 0
# -------------------------------------------------------------- layout ----- #
# automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
# theme
set -g status-bg black
set -g status-fg white
# set -g window-status-current-bg white
# set -g window-status-current-fg black
# set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
# set footer status bar
set -g status-left 'tmux #[fg=green](#S) #(whoami) '
set -g status-right '#[fg=green]%H:%M#[default]'
# ------------------------------------------------ key bindings aliases ----- #
# default prefix key ctrl+b
# bind is an alias for bind-key
# https://superuser.com/questions/581939/on-tmux-what-is-the-difference-between-bind-and-bind-key
# https://www.man7.org/linux/man-pages/man1/tmux.1.html
# M- key is alt
# S- key is shift
# -n is an alias for -T root (which means no prefix key)
# reload tmux config
bind r source-file ~/.tmux.conf
# shift arrow to switch windows
# ctrl-b c for new window
# ctrl-b w for list all windows
bind -n S-Left previous-window
bind -n S-Right next-window
# set split screen commands - default is " and %
bind | split-window -h
bind - split-window -v
# vim style pane selection
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes
bind J resize-pane -D 10
bind K resize-pane -U 10
bind H resize-pane -L 10
bind L resize-pane -R 10
# use alt-vim keys without prefix key to switch panes (no prefix bind)
# bind -n M-h select-pane -L
# bind -n M-j select-pane -D
# bind -n M-k select-pane -U
# bind -n M-l select-pane -R
# use alt-arrow keys without prefix key to switch panes (no prefix bind)
# bind -n M-Left select-pane -L
# bind -n M-Right select-pane -R
# bind -n M-Up select-pane -U
# bind -n M-Down select-pane -D
# ------------------------------------------------------ copy and paste ----- #
# https://dev.to/iggredible/the-easy-way-to-copy-text-in-tmux-319g
# crtl-b [ enter copy mode
# / or ? search
# n or N search next forward/backward
# space select text
# q or enter exit mode
# crtl-b ] paste from tmux buffer (to tmux only)
# keywords
# bind alias for bind-key
# send alias for send-key
# mac specific copy
# enter -T(keybinding table) copy-mode with default ctrl-b [
# enable for terminal mode vi like mapping to map above default
# ctrl-b [ with select v and yank y, and ctrl-b P with paste
# note v alias doesnt seem to work
bind -T copy-mode-vi v send -X begin-selection
bind -T copy-mode-vi y send -X copy-pipe-and-cancel "pbcopy"
bind P paste-buffer
# enable for terminal mouse drag copy
bind -T copy-mode-vi MouseDragEnd1Pane send -X copy-pipe-and-cancel "pbcopy"
# older config
# bind -T copy-mode-vi y send-keys -X copy-pipe-and-cancel pbcopy
# bind -T copy-mode C-w send-keys -X copy-pipe-and-cancel pbcopy
# bind -T copy-mode M-w send-keys -X copy-pipe-and-cancel pbcopy
# bind -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel pbcopy
# bind -T copy-mode-vi C-j send-keys -X copy-pipe-and-cancel pbcopy
# bind -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel pbcopy