-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
97 lines (77 loc) · 3.33 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
# change prefix from ctrl-b to ctrl-a
set -g prefix C-a
# 256 colors for vim
set -g default-terminal "screen-256color"
# set vi key mode
setw -g mode-keys vi
# the following is made redundand because wsl allows copying
# with mouse by pushing ctrl while marking and copying/pasting with right-click
# set copy mode (usualy [ and ]) to vim like keys
# ctrl-a and Escape to enter copy mode, q to exit
unbind [
bind Escape copy-mode
set-option -s set-clipboard off
# ctrl-a p pastes text
unbind p
bind p paste-buffer
# v to begin selection y to copy selection
bind-key -T copy-mode-vi 'v' send -X begin-selection
bind-key -T copy-mode-vi 'y' send -X copy-selection
# copy tmux buffer to clipboard using xclip (https://coderwall.com/p/4b0d0a/how-to-copy-and-paste-with-tmux-on-ubuntu)
# apt-get install xclip
#bind-key -T copy-mode-vi 'y' send -X copy-pipe "xclip -sel clip -i"
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe-and-cancel "xclip -se c -i"
# Start window numbering at 1
set-option -g base-index 1
set-window-option -g pane-base-index 1
# reload config with a key
bind-key r source-file ~/.tmux.conf \; display "Config reloaded!"
# C-l is taken over by vim style pane navigation
bind C-l send-keys 'C-l'
# Clear the pane and it's history
# bind -n C-k send-keys C-l \; clear-history
unbind C-l
# mouse on
set-option -g mouse on
# 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"
# # split panes like vim
bind-key j split-window -v -c "#{pane_current_path}"
bind-key k split-window -v -c "#{pane_current_path}"
bind-key h split-window -h -c "#{pane_current_path}"
bind-key l split-window -h -c "#{pane_current_path}"
# Shift + arrows to resize pane
bind -n S-Left resize-pane -L 2
bind -n S-Right resize-pane -R 2
bind -n S-Down resize-pane -D 1
bind -n S-Up resize-pane -U 1
# allow moving between whole words while in the commandline
set-window-option -g xterm-keys on
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'seebi/tmux-colors-solarized'
set -g @plugin 'tmux-plugins/tmux-resurrect'
# set -g @plugin 'tmux-plugins/tmux-continuum'
# set -g @plugin 'christoomey/vim-tmux-navigator'
# set -g @colors-solarized 'dark'
# give active pane a different color to highlight it
# overrides solarized color theme
# set -g window-active-style 'bg=#002b36'
set -g window-active-style 'bg=#003533'
# set key bindings for tmux-resurrect
bind C-s run-shell ~/.tmux/plugins/tmux-resurrect/scripts/save.sh
bind C-r run-shell ~/.tmux/plugins/tmux-resurrect/scripts/restore.sh
# tmux-continuum configuration
#set -g @continuum-restore 'on'
#set -g @continuum-save-interval '15'
#set -g status-right 'Continuum status: #{continuum_status}' # display tmux-continuum status in status line
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run -b '~/.tmux/plugins/tpm/tpm'