aboutsummaryrefslogtreecommitdiff
path: root/.tmux.conf
blob: f28b43ea8188f7005ddd3e9bf43f65d7ecf4a71e (plain)
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
# Plugins

set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'tmux-plugins/tmux-resurrect'

set -g @plugin 'sainnhe/tmux-fzf'
TMUX_FZF_OPTIONS="-p 80%,80% -m"
TMUX_FZF_PREVIEW=0
bind f run-shell -b "~/.tmux/plugins/tmux-fzf/scripts/session.sh attach"

set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @continuum-restore 'on'

if "test ! -d ~/.tmux/plugins/tpm" \
   "run 'git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm && ~/.tmux/plugins/tpm/bin/install_plugins'"
run '~/.tmux/plugins/tpm/tpm'

# general

unbind C-b
unbind C-q

unbind C-s
set -g prefix 'C-s'
bind 'C-s' send-prefix -2
set -sg escape-time 0

set -g default-terminal "xterm-256color"
bind r source-file ~/.tmux.conf \; display '~/.tmux.conf sourced'

set -g mouse on
set-option -g allow-rename off
set-option -g renumber-windows on

# vim mode
set-window-option -g mode-keys vi

# navigation

bind v split-window -h -c '#{pane_current_path}'
bind s split-window -v -c '#{pane_current_path}'
bind c new-window -c "#{pane_current_path}"
unbind '"'
unbind %

## swtich between pane
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R

## resize the pane
bind < resize-pane -L 5
bind > resize-pane -R 5
bind - resize-pane -D 5
bind + resize-pane -U 5

set -s copy-command 'wl-copy'
# copy and paste like vim
bind -T copy-mode-vi 'v' send -X begin-selection
bind -T copy-mode-vi 'y' send -X copy-pipe-and-cancel "reattach-to-user-namespace wl-copy"
bind P paste-buffer

if-shell 'test -f "$HOME/.local/.tmux.conf"' 'source ~/.local/.tmux.conf'

bind C-j command-prompt -p "join pane from: " "join-pane -h -s '%%'"

# move pane to the far right/left/bottom/top
bind H splitw -fhb \; swapp -t ! \; killp -t !
bind L splitw -fh  \; swapp -t ! \; killp -t !
bind J splitw -fv  \; swapp -t ! \; killp -t !
bind K splitw -fvb \; swapp -t ! \; killp -t !