This repository has been archived by the owner on Nov 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
138 lines (102 loc) · 5.5 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
135
136
137
138
#############################################
# based on https://github.com/gpakosz/.tmux #
#############################################
# -- general -------------------------------------------------------------------
set -ga terminal-overrides ",xterm-256color:Tc"
set -g default-terminal "xterm-256color"
setw -g xterm-keys on
set -s escape-time 10 # faster command sequences
set -sg repeat-time 600 # increase repeat timeout
set -s focus-events on
set-option -g prefix C-j
unbind-key C-b
bind-key C-j send-prefix
setw -q -g utf8 on
set -g history-limit 65535 # set long history
# reload configuration
bind-key r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'
# -- display -------------------------------------------------------------------
set -g base-index 1 # start windows numbering at 1
setw -g pane-base-index 1 # make pane numbering consistent with windows
setw -g automatic-rename on # rename window to reflect current program
set -g renumber-windows on # renumber windows when a window is closed
set -g set-titles on # set terminal title
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
set -g status-interval 1 # redraw status line every second
# activity
set -g monitor-activity on
set -g visual-activity off
# show current path in border
set -g pane-border-status bottom
set -g pane-border-format '#P: #{=/-40/...:pane_current_path} #(~/.tmux/vcs-status.sh #{pane_current_path} #{pane_active})'
# -- navigation ----------------------------------------------------------------
# create session
bind-key C-c new-session
# find session
bind-key C-f command-prompt -p find-session 'switch-client -t %%'
# create new window in current path
bind-key C new-window -c "#{pane_current_path}"
# split current window horizontally
bind-key '"' split-window -v -c "#{pane_current_path}"
bind-key - split-window -v -c "#{pane_current_path}"
# split current window vertically
bind-key % split-window -h -c "#{pane_current_path}"
bind-key _ split-window -h -c "#{pane_current_path}"
# pane navigation
bind-key -r h select-pane -L # move left
bind-key -r j select-pane -D # move down
bind-key -r k select-pane -U # move up
bind-key -r l select-pane -R # move right
bind-key > swap-pane -D # swap current pane with the next one
bind-key < swap-pane -U # swap current pane with the previous one
# move window one left
bind-key -r S-Left swap-window -d -t -1
bind-key -r H swap-window -d -t -1
# move window one right
bind-key -r S-Right swap-window -d -t +1
bind-key -r L swap-window -d -t +1
# -- copy mode -----------------------------------------------------------------
bind-key Enter copy-mode # enter copy mode
run -b 'tmux bind-key -t vi-copy v begin-selection 2> /dev/null || true'
run -b 'tmux bind-key -T copy-mode-vi v send -X begin-selection 2> /dev/null || true'
run -b 'tmux bind-key -t vi-copy C-v rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind-key -T copy-mode-vi C-v send -X rectangle-toggle 2> /dev/null || true'
run -b 'tmux bind-key -t vi-copy y copy-selection 2> /dev/null || true'
run -b 'tmux bind-key -T copy-mode-vi y send -X copy-selection-and-cancel 2> /dev/null || true'
run -b 'tmux bind-key -t vi-copy Escape cancel 2> /dev/null || true'
run -b 'tmux bind-key -T copy-mode-vi Escape send -X cancel 2> /dev/null || true'
run -b 'tmux bind-key -t vi-copy H start-of-line 2> /dev/null || true'
run -b 'tmux bind-key -T copy-mode-vi H send -X start-of-line 2> /dev/null || true'
run -b 'tmux bind-key -t vi-copy L end-of-line 2> /dev/null || true'
run -b 'tmux bind-key -T copy-mode-vi L send -X end-of-line 2> /dev/null || true'
# copy to Mac OSX clipboard
if -b 'command -v reattach-to-user-namespace > /dev/null 2>&1' 'bind-key y run -b "tmux save-buffer - | reattach-to-user-namespace pbcopy"'
# copy to X11 clipboard
if -b 'command -v xsel > /dev/null 2>&1' 'bind-key y run -b "tmux save-buffer - | xsel -i -b"'
if -b '! command -v xsel > /dev/null 2>&1 && command -v xclip > /dev/null 2>&1' 'bind-key y run -b "tmux save-buffer - | xclip -i -selection clipboard >/dev/null 2>&1"'
# copy to Windows clipboard
if -b 'command -v clip.exe > /dev/null 2>&1' 'bind-key y run -b "tmux save-buffer - | clip.exe"'
if -b '[ -c /dev/clipboard ]' 'bind-key y run -b "tmux save-buffer - > /dev/clipboard"'
# -- buffers -------------------------------------------------------------------
bind-key b list-buffers # list paste buffers
bind-key p paste-buffer # paste from the top paste buffer
bind-key P choose-buffer # choose which buffer to paste from
# -- theme ---------------------------------------------------------------------
# configure border
#set -g pane-border-style "fg=#444444,bg=default"
set -g pane-active-border-style "fg=#3971ed,bg=default"
# default status
set -g status-style fg=white,bg=default
# window indicator
set -g window-status-separator " "
set -g window-status-style "fg=#ffffff,bg=#264b9e"
set -g window-status-current-style "fg=#ffffff,bg=#3971ed"
set -g window-status-activity-style "fg=#ffffff,bg=#cc342b"
set -g window-status-bell-style "fg=#ffffff,bg=#cc342b"
# status left
set -g status-left-length 40
set -g status-left "#[fg=#ffffff]#[bg=#198844] #S #[fg=#ffffff]#[bg=#ffffff] "
# status right
set -g status-right-length 50
set -g status-right ' #[fg=#ffffff]#[bg=#198844] %Y-%m-%d #[fg=#ffffff]#[bg=#ffffff] #[fg=#ffffff]#[bg=#198844] %H:%M #[fg=#ffffff]#[bg=#ffffff] #[fg=#ffffff]#[bg=#3971ed] #(id -nu) @ #h '