-
Notifications
You must be signed in to change notification settings - Fork 0
/
yuhc-tmux.conf
153 lines (123 loc) · 5.28 KB
/
yuhc-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
##############################
# _ #
# | |_ _ __ ___ _ ___ __ #
# | __| '_ ` _ \| | | \ \/ / #
# | |_| | | | | | |_| |> < #
# \__|_| |_| |_|\__,_/_/\_\ #
# yuhc-tmux-conf #
##############################
############################################################################
# Global options
############################################################################
# large history
# basic settings
set-window-option -g xterm-keys on # for vim
set-window-option -g mode-keys vi # vi key
# Mouse support
# http://floriancrouzat.net/2010/07/run-tmux-with-mouse-support-in-mac-os-x-terminal-app/
set-option -g mouse on
setw -g mouse on
# make scrolling with wheels work
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
# -- general -------------------------------------------------------------------
#
set -g default-terminal "screen-256color" # colors
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 -g history-limit 10000 # boost history
# reload configuration
bind 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
# Titles (window number, program name, active (or not)
set -g set-titles on # set terminal title
set-option -g set-titles-string '#H:#S.#I.#P #W #T'
set -g display-panes-time 800 # slightly longer pane indicators display time
set -g display-time 1000 # slightly longer status messages display time
# clear both screen and history
bind -n C-l send-keys C-l \; run 'sleep 0.1' \; clear-history
# activity
set-window-option -g monitor-activity on
set-option -g visual-activity on
# -- status bar ----------------------------------------------------------------
#
set-option -g status-justify right
set-option -g status-bg black # colour213 # pink
set-option -g status-fg cyan
set-option -g status-interval 5 # redraw status line every 10 seconds
set-option -g status-left-length 30
set-option -g status-left '#[fg=magenta]» #[fg=blue,bold]#T#[default]'
set-option -g status-right '#[fg=red,bold][[ #(git branch) branch ]]'
#[fg=cyan]»» #[fg=blue,bold]###S #[fg=magenta]%R %m-%d#(acpi | cut -d ',' -f 2)#[default]'
############################################################################
# COPY AND PASTE
# Enter copy mode: Prefix+[
# Begin selection: v
# Copy selection: y
# Paste selection: Prefix+p or C+S+v
############################################################################
# Use vim keybindings in copy mode
setw -g mode-keys vi
bind [ copy-mode
unbind p
bind p paste-buffer
# For vi copy mode bindings
bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"
# For emacs copy mode bindings
bind-key -T copy-mode MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "xclip -selection clipboard -i"
############################################################################
# Unbindings
############################################################################
unbind j
#unbind C-b # unbind default prefix key
unbind '"' # unbind horizontal split
unbind % # unbind vertical split
############################################################################
# Bindings
############################################################################
# Reset Prefix
#set -g prefix C-a
#bind-key a send-prefix # for nested tmux sessions
# reload tmux conf
bind-key r source-file ~/.tmux.conf
bind-key Space list-panes # list panes
bind-key Enter break-pane # break-pane
#previous pane
bind-key -n C-up prev
bind-key -n C-left prev
#next pane
bind-key -n C-right next
bind-key -n C-down next
############################################################################
# Panes and Navigation
# use the vim motion keys to move between panes
############################################################################
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Resizing
bind-key C-h resize-pane -L
bind-key C-j resize-pane -D
bind-key C-k resize-pane -U
bind-key C-l resize-pane -R
############################################################################
# Load other Configurations
############################################################################
TMUX_DIR=$HOME/.yuhc-tmux
if '[ -f $TMUX_DIR/pakosz_tmux.conf ]' 'source $TMUX_DIR/pakosz_tmux.conf'
# https://stackoverflow.com/a/40902312
run-shell 'tmux setenv -g TMUX_VERSION $(tmux -V | \
sed -En "s/^tmux[^0-9]*([.0-9]+).*/\1/p")'
if-shell -b '[ "$(echo "$TMUX_VERSION >= 2.9" | bc)" = 1 ]' \
'source-file $TMUX_DIR/tmux_2.9_up.conf'
if-shell -b '[ "$(echo "$TMUX_VERSION < 2.9" | bc)" = 1 ]' \
'source $TMUX_DIR/tmux_2.9_down.conf'