-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
72 lines (57 loc) · 2.46 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
# set prefix to metaky + d
set-option -g prefix C-Space
# okay... so the mouse alright for scrolling
set -g mouse on
# performance stuff
set -g default-terminal "xterm-256color"
set-option -s escape-time 10
set -g history-limit 10000
# copy-paste integration (if on macOS, run 'brew install reattach-to-user-namespace'
if-shell "uname | grep -q Darwin" "set-option -g default-command 'reattach-to-user-namespace -l zsh'"
# use vim keybindings in copy mode
setw -g mode-keys vi
# setup 'v' to begin selection as in Vim
bind-key -T copy-mode-vi v send-keys -X begin-selection
bind-key -T copy-mode-vi y send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# update default binding of 'Enter' to also use copy-pipe
unbind-key -T copy-mode-vi Enter
bind-key -T copy-mode-vi Enter send-keys -X copy-pipe-and-cancel "reattach-to-user-namespace pbcopy"
# split panes using h and v
bind h split-window -v -c "#{pane_current_path}"
bind v split-window -h -c "#{pane_current_path}"
unbind '"'
unbind %
# reload config file with prefix + r
bind r source-file ~/.tmux.conf
# switch between panes using vi-like commands an no prefix
# bind -n C-h select-pane -L
# bind -n C-l select-pane -R
# bind -n C-k select-pane -U
# bind -n C-j select-pane -D
# swap panes
bind k swap-pane -U
bind j swap-pane -D
# clear terminal output
bind -n C-n send-keys -R Enter
# 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 -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n 'C-\' if-shell "$is_vim" "send-keys 'C-\\'" "select-pane -l"
bind -T copy-mode-vi C-h select-pane -L
bind -T copy-mode-vi C-j select-pane -D
bind -T copy-mode-vi C-k select-pane -U
bind -T copy-mode-vi C-l select-pane -R
bind -T copy-mode-vi 'C-\' select-pane -l
# Format tmux line after airline (if it exists)
source-file ~/dotfiles/tmuxline_snapshot
# if-shell "test -f ~/dotfiles/tmuxline_snapshot" "source ~/dotfiles/tmuxline_snapshot""
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
# Initialize TMUX plugin manager (keep this line at the very bottom of .tmux.conf)
run '~/.tmux/plugins/tpm/tpm'