-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
103 lines (82 loc) · 3.19 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
# tmux config
# display 256 colors
set -g default-terminal "screen-256color"
# set scrollback to 10k lines
set -g history-limit 10000
# set prefix key to ^a
set -g prefix C-a
bind-key -n C-q send-prefix
unbind-key C-b
# ctrl-a-a to go to beginning of line
bind a send-prefix
# less insane window splitting
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# reload config file
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# ---------------------
# Copy & Paste
# ---------------------
# provide access to the clipboard for pbpaste, pbcopy
set-option -g default-shell $SHELL
set-option -g default-command "reattach-to-user-namespace -l ${SHELL}"
set-window-option -g automatic-rename on
# setup 'v' to begin selection as in Vim
#bind-key -t vi-copy v begin-selection
# bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# bind-key -T copy-mode-vi MouseDragEnd1Pane send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy" \; display-message "copied to paste buffer"
setw -g mode-keys vi
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe "reattach-to-user-namespace pbcopy" \; display-message "copied to paste buffer"
# map Vi movement keys as pane movement
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# sane spacemacs navigation
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
is_fzf="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?fzf$'"
is_emacs="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?emacs$'"
bind -n C-h run "($is_vim && tmux send-keys C-h) || \
($is_emacs && tmux send-keys C-h) || \
tmux select-pane -L"
bind -n C-j run "($is_vim && tmux send-keys C-j) || \
($is_emacs && tmux send-keys C-j) || \
($is_fzf && tmux send-keys C-j) || \
tmux select-pane -D"
bind -n C-k run "($is_vim && tmux send-keys C-k) || \
($is_emacs && tmux send-keys C-k) || \
($is_fzf && tmux send-keys C-k) || \
tmux select-pane -U"
bind -n C-l run "($is_vim && tmux send-keys C-l) || \
($is_emacs && tmux send-keys C-l) || \
tmux select-pane -R"
# Fix escape delay within vim/emacs
set -sg escape-time 0
# Start windows and panes at 1, not 0
set -g base-index 1
set -g pane-base-index 1
set-option -g status-position top
set-option -g repeat-time 0
# List of plugins
set -g @tpm_plugins ' \
caiogondim/maglev \
tmux-plugins/tpm \
tmux-plugins/tmux-sensible \
tmux-plugins/tmux-resurrect \
tmux-plugins/tmux-continuum \
tmux-plugins/tmux-yank \
tmux-plugins/tmux-pain-control \
tmux-plugins/tmux-copycat \
tmux-plugins/tmux-open \
tmux-plugins/tmux-battery \
tmux-plugins/tmux-cpu \
tmux-plugins/tmux-prefix-highlight \
'
# Initialize TMUX plugin manager
run '~/.tmux/plugins/tpm/tpm'