.tmux.conf 2.49 KB
Newer Older
Nelso Jost's avatar
Nelso Jost committed
1
2
3
4
5
6
7
# remap prefix to Control + a
set -g prefix C-a
# bind 'C-a C-a' to type 'C-a'
bind C-a send-prefix
unbind C-b

# http://stackoverflow.com/questions/18600188/home-end-keys-do-not-work-in-tmux
8
9
#setw -g utf8 on
#setw -g xterm-keys on
Nelso Jost's avatar
Nelso Jost committed
10
11
12
13
14
15
16
17
set -g default-terminal "screen-256color"

# Start windows and panes at 1, not 0
set -g base-index 1
setw -g pane-base-index 1

# https://github.com/neovim/neovim/issues/2035
set -sg escape-time 0
18
set-option -sg repeat-time 0
Nelso Jost's avatar
Nelso Jost committed
19

20
21
22
23
24
25
26
27
# enter scroll/copy-mode with pageup
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n Pageup if-shell "$is_vim" "send-keys Pageup" "copy-mode -u"
bind -n S-Pageup if-shell "$is_vim" "send-keys Pageup" "copy-mode -u"
bind -n S-Pagedown send-keys Pagedown

# send xterm keys to apps like vim
Nelso Jost's avatar
Nelso Jost committed
28
29
set-window-option -g xterm-keys on

30
31
32
bind-key s split-window -h -l 55 -c '#{pane_current_path}'
bind-key v split-window -v -c '#{pane_current_path}'
bind-key C-q kill-server
33
bind-key C-w kill-window
34
bind-key w new-window
35
bind-key TAB last-pane
Nelso Jost's avatar
Nelso Jost committed
36
37
38
39
40
41
42
43
44
45

#run-shell ~/resurrect.tmux
#

# https://github.com/tmux-plugins/tmux-resurrect/blob/master/docs/restoring_vim_and_neovim_sessions.md
set -g @resurrect-strategy-nvim 'session'

set -g @resurrect-processes '~python'


46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62

# 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"
#bind-key -T copy-mode-vi C-h select-pane -L
#bind-key -T copy-mode-vi C-j select-pane -D
#bind-key -T copy-mode-vi C-k select-pane -U
#bind-key -T copy-mode-vi C-l select-pane -R
#bind-key -T copy-mode-vi C-\ select-pane -l


Nelso Jost's avatar
Nelso Jost committed
63
64
65
66
# List of plugins
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-resurrect'
67
set -g @plugin 'christoomey/vim-tmux-navigator'
Nelso Jost's avatar
Nelso Jost committed
68
69
70
71
72
73
74
75

# Other examples:
# set -g @plugin 'github_username/plugin_name'
# set -g @plugin 'git@github.com/user/plugin'
# set -g @plugin 'git@bitbucket.com/user/plugin'

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'