-
Notifications
You must be signed in to change notification settings - Fork 0
/
.tmux.conf
115 lines (82 loc) · 3.78 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
104
105
106
107
108
109
110
111
112
113
114
115
# improve colors
set -g default-terminal 'screen-256color'
# enable utf-8 on status bar
set -g status on
set -g status-utf8 on
# act like GNU screen
unbind C-b
set -g prefix C-a
# start window numbers at 1 to match keyboard order with tmux window order
set -g base-index 1
# renumber windows sequentially after closing any of them
set -g renumber-windows on
set-window-option -g pane-base-index 1
# soften status bar color from harsh green to light gray
set -g status-bg '#666666'
set -g status-fg '#aaaaaa'
# remove administrative debris (session name, hostname, time) in status bar
#set -g status-left ''
#set -g status-right ''
# remove auto-rename of windows
set-window-option -g automatic-rename on
# reload settings
bind-key R source-file ~/.tmux.conf \; display-message "Configuration reloaded!"
### Statusbar settings
# toggle statusbar
#bind-key s set status
# use vi-style key bindings in the status line
set -g status-keys vi
# amount of time for which status line messages and other indicators
# are displayed. time is in milliseconds.
set -g display-time 2000
# http://tjvanslyke.com/tmux-for-vim-users/
# change prefix to Control-a instead of Control-b (also, CTRL has been mapped to caps)
set -g prefix C-a
unbind C-b
# Next, I set the history limit to 100000 lines. This allows scrolling back as far as you'll ever need using Ctrl+A [.
set-option -g history-limit 100000
setw -g xterm-keys on
set-option -g default-terminal "screen-256color"
# The default keybindings for splitting windows are poorly defined in the % key.
# To provide more memorable shortcuts, I've bound them to | and - for vertical and horizontal splits, respectively.
# This means you can press Ctrl+A | to split your current pane into two vertically, and Ctrl+A - to split it horizontally.
bind-key | split-window -h
bind-key - split-window
# One of my most commonly used Vim features is the Ctrl+W pane navigation commands.
# These allow easy navigation between all your visible editor panes.
# This behavior can be mimicked in tmux by binding the hjkl keys to the select-pane command:
#unbind-key j
#bind-key j select-pane -D
#unbind-key k
#bind-key k select-pane -U
#unbind-key h
#bind-key h select-pane -L
#unbind-key l
#bind-key l select-pane -R
# Restore Clear Screen
bind-key l send-keys 'C-l'
# Smart pane switching with awareness of vim splits. Need to have vim-tmux-navigator plugin for it to work
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iqE '(^|\/)vim(diff)?$' && tmux send-keys 'C-\\') || tmux select-pane -l"
# TMUX book from PragProg
# make keys more responsive
set -s escape-time 1
# window resizing
bind -r H resize-pane -L 5
bind -r J resize-pane -D 5
bind -r K resize-pane -U 5
bind -r L resize-pane -R 5
# enable pbcopy/pbpaste in tmux!!
set-option -g default-command "reattach-to-user-namespace -l bash"
# use tmuxline snapshot for statusbar setup
source ~/.tmux-snapshot
set-option -g status-interval 1
# 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"
# # Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"