-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmux.conf
86 lines (70 loc) · 3.06 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
# $Id: vim-keys.conf,v 1.2 2010-09-18 09:36:15 nicm Exp $
#
# vim-keys.conf, v1.2 2010/09/12
#
# By Daniel Thau. Public domain.
#
# This configuration file binds many vi- and vim-like bindings to the
# appropriate tmux key bindings. Note that for many key bindings there is no
# tmux analogue. This is intended for tmux 1.3, which handles pane selection
# differently from the previous versions
# split windows like vim
# vim's definition of a horizontal/vertical split is reversed from tmux's
bind s split-window -v
bind v split-window -h
# move around panes with hjkl, as one would in vim after pressing ctrl-w
bind h select-pane -L
bind j select-pane -D
bind k select-pane -U
bind l select-pane -R
# resize panes like vim
# feel free to change the "1" to however many lines you want to resize by, only
# one at a time can be slow
bind < resize-pane -L 1
bind > resize-pane -R 1
bind - resize-pane -D 1
bind + resize-pane -U 1
# bind : to command-prompt like vim
# this is the default in tmux already
bind : command-prompt
# vi-style controls for copy mode
setw -g mode-keys vi
###################################################
# Doug's additions
###################################################
# make *vim-like bindings for changing pane
# *note: these match the bindings I added to ~/.vimrc
bind C-h select-pane -L
bind C-j select-pane -D
bind C-k select-pane -U
bind C-l select-pane -R
# use GNU screen prefix instead
unbind C-b
set -g prefix C-a
bind C-a send-prefix
# vim-tmux-navigator binding
# 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"
# fix visual mode highlighting issues in vim
set -g default-terminal "tmux-256color"
# make binding for `choose-session` since vim-like bindings broke original
bind S choose-session
# make 'detach current client' keybinding detach _all_ clients
bind-key d detach-client
# enable mouse support
# set -g mouse on
# share default register, X selection clipboard, and system clipboard
# bind-key -n -T copy-mode-vi M-y send -X copy-pipe "xclip -f | xclip -sel clip"
# bind-key -n -T vi-copy MouseDragEnd1Pane send -X copy-pipe "xclip -f | xclip -sel clip"
bind -Tcopy-mode-vi Enter send -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c" \; display-message "copied to system clipboard" \; send-keys q
bind -Tcopy-mode-vi MouseDragEnd1Pane send -X copy-pipe "xclip -i -sel p -f | xclip -i -sel c" \; display-message "copied to system clipboard" \; send-keys q
bind-key ] run "xclip -o -sel clip | tmux load-buffer - ; tmux paste-buffer"
# powerline
source "$HOME/.local/lib/python3.7/site-packages/powerline/bindings/tmux/powerline.conf"