-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathln_tmux.conf
More file actions
112 lines (102 loc) · 4.29 KB
/
ln_tmux.conf
File metadata and controls
112 lines (102 loc) · 4.29 KB
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
## GENERAL
# Set PREFIX to CTRL+A
set -g prefix C-a
# Ensure that we can send Ctrl-A to other apps
bind C-a send-prefix
#Free the original Ctrl-b prefix keybinding
unbind C-b
# reloading tmux config in current session
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# remove key stroke delay time -> make tmux more responsive
set -s escape-time 1
# Set the repeat-time to 1 second so that multiple commands can be entered
# without sending the prefix-key within 1 second. Commands are made repeatable
# by -r option of bind-key. By default it is 500 ms.
set -g repeat-time 1000
# No mouse here !!! :)
set -g mouse off
# Set the default terminal mode to 256color mode
set -g default-terminal "screen-256color"
# auto renumbering of windows when one of them has been closed
set -g renumber-windows on
# Infinite history
set -g history-limit 10000000
## WINDOWS
# Set base index for windows to be 1 instead of 0
set -g base-index 1
# Quick window selection
bind -r C-h select-window -t :-
bind -r C-l select-window -t :+
# ? agressice windows resize
setw -g aggressive-resize on
# VI keys
setw -g mode-keys vi
## PANES
# Set the base index for panes to 1 instead of 0
setw -g pane-base-index 1
# Start new window with current directory
bind c new-window -c "#{pane_current_path}"
# Makes splitting easier to remember and start with current directory
bind | split-window -h -c "#{pane_current_path}"
bind - split-window -v -c "#{pane_current_path}"
# Moving between panes with Prefix h,j,k,l
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# Resizing panes
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# 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 'M-h' if-shell "$is_vim" 'send-keys C-h' 'select-pane -L'
bind-key -n 'M-j' if-shell "$is_vim" 'send-keys C-j' 'select-pane -D'
bind-key -n 'M-k' if-shell "$is_vim" 'send-keys C-k' 'select-pane -U'
bind-key -n 'M-l' if-shell "$is_vim" 'send-keys C-l' 'select-pane -R'
tmux_version='$(tmux -V | sed -En "s/^tmux ([0-9]+(.[0-9]+)?).*/\1/p")'
if-shell -b '[ "$(echo "$tmux_version < 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys C-\\' 'select-pane -l'"
if-shell -b '[ "$(echo "$tmux_version >= 3.0" | bc)" = 1 ]' \
"bind-key -n 'M-\\' if-shell \"$is_vim\" 'send-keys C-\\\\' 'select-pane -l'"
bind-key -T copy-mode-vi 'M-h' select-pane -L
bind-key -T copy-mode-vi 'M-j' select-pane -D
bind-key -T copy-mode-vi 'M-k' select-pane -U
bind-key -T copy-mode-vi 'M-l' select-pane -R
bind-key -T copy-mode-vi 'M-\' select-pane -l
# Colours
# set the status line's colors
set -g status-style fg=white,bg=black
# set the color of the window list
setw -g window-status-style fg=cyan,bg=black
setw -g window-status-current-style fg=white,bold,bg=red
# pane borders' colours
setw -g pane-border-style fg=green,bg=black
setw -g pane-active-border-style fg=white,bg=yellow
# active pane normal, other shaded out
setw -g window-style fg=colour240,bg=colour235
setw -g window-active-style fg=white,bg=black
# command/message line
set -g message-style fg=white,bold,bg=black
# Status line left side to show Session:window:pane
set -g status-left-length 40
set -g status-left "#[fg=green]Session: #S #[fg=yellow]#I #[fg=cyan]#P"
# Status line right side - 31 Oct 13:37
set -g status-right "#[fg=cyan]%d %b %R"
# Update the status line every sixty seconds
set -g status-interval 60
# Center the window list in the status line
set -g status-justify centre
# enable activity alerts
setw -g monitor-activity on
set -g visual-activity on
# VIM-like copy&paste (xclip)
bind Escape copy-mode
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c" \; display-message "copied to system clipboard"
unbind p
bind p run "tmux set-buffer \"$(xclip -o -selection clipboard)\"; tmux paste-buffer"
if-shell "[ -f ~/.tmux.conf.local ]" 'source ~/.tmux.conf.local'