-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.tmux.conf
164 lines (127 loc) · 6.33 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# -----------------------------------------------------------------------------
# ******* WARNING: Make sure to quit all tmux sessions in order to ensure
# ******* any changes to this file take effet correctly. Otherwise, some
# ******* changes to this file may not have the desired effects until all
# ******* sessions are exited - and restarted.
# -----------------------------------------------------------------------------
# HIGH_SIERRA FIX?: set-window-option -g mode-mouse on
set-window-option -g mouse on
##################################################################################
# Improvements to the Default TMUX settings here were found on a thoughtbot post
# -- http://robots.thoughtbot.com/post/2166174647/love-hate-tmux
#
##################################################################################
# possible fix for tmuxinator "failed to connect to server" error
set -g base-index 1
set -g pane-base-index 1
set-option -g base-index 1
#set-option -g renumber-windows on
set-window-option -g pane-base-index 1
# improve colors
set -g default-terminal "screen-256color"
# soften status bar color from harsh green to light gray
set -g status-bg '#616431'
set -g status-fg '#aaaaaa'
# remove administrative debris (session name, hostname, time) in status bar
set -g status-left ''
set -g status-right '[#S : #W (#I)] '
############################################################################
## Bindings
#############################################################################
unbind h
unbind j
unbind k
unbind l
# The “prefix” namespaces tmux commands. By default it is Ctrl+b. In our tmux.conf in
# thoughtbot/dotfiles, we bound it to Ctrl+a:
#
# act like GNU screen
unbind C-b
set -g prefix C-g
# Fix Copy/Paste from pasteboard in Mac-OSX
# -- http://robots.thoughtbot.com/post/19398560514/how-to-copy-and-paste-with-tmux-on-mac-os-x
# $> brew install reattach-to-user-namespace
#
# enable copy-paste http://goo.gl/DN82E
# enable RubyMotion http://goo.gl/WDlCy
set -g default-command "reattach-to-user-namespace -l bash"
############################################################################
## Bindings
#############################################################################
# reload tmux conf
bind r source-file ~/.tmux.conf
############################################################################
## sessions
############################################################################
# Pick from list of TMUX sessions
bind-key C-j choose-tree
############################################################################
## windows
############################################################################
# use "v" and "s" to do vertical/horizontal splits, like vim
bind s split-window -v -c '#{pane_current_path}'
bind v split-window -h -c '#{pane_current_path}'
bind n next-window
bind p previous-window
# break pane into a new window
bind-key b break-pane -d
bind-key Enter break-pane -d
# create new window
bind c new-window -c '#{pane_current_path}'
############################################################################
## panes
############################################################################
# list panes
bind-key Space list-panes
# smart pane switching with awareness of vim splits
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n 'C-\' run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
# use the vim resize keys.
# the number at the end is how much the pane will be resized,
# and 1 is fairly small -- you might want to tweak this.
bind h resize-pane -L 5
bind l resize-pane -R 5
bind j resize-pane -D 5
bind k resize-pane -U 5
############################################################################
## vim key-bindings for cut/copy mode
############################################################################
# OLD-WAY: https://thoughtbot.com/blog/tmux-copy-paste-on-os-x-a-better-future
# NEW-WAY: http://www.rushiagr.com/blog/2016/06/16/everything-you-need-to-know-about-tmux-copy-pasting/
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
# PRE_HIGH_SIERRA: bind-key -t vi-copy v begin-selection
bind-key -T copy-mode-vi 'v' send-keys -X begin-selection
# PRE_HIGH_SIERRA: bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi 'y' send-keys -X copy-pipe "xclip -in -selection clipboard"
# Update default binding of `Enter` to also use copy-pipe
#
# PRE_HIGH_SIERRA: unbind -t vi-copy Enter
unbind -T copy-mode-vi Enter
# PRE_HIGH_SIERRA: bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbcopy"
bind-key -T copy-mode-vi Enter send-keys -X copy-selection-and-cancel
############################################################################
## vim key-bindings for cut/copy mode
############################################################################
## Examples of quickly opening shell utils in a tmux window
#bind-key h split-window -h "htop"
#bind-key t split-window -h -c ~/ "vim todo.md"
#bind-key w split-window -h -c ~/my-wiki "vim +CtrlP"
# Prompted join-pane
bind-key J command-prompt -p "join pane from: " "join-pane -h -s '%%'"
# Easily swap a pane (targeted by pane number) with the current pane
bind-key o display-panes\; command-prompt -p "pane #: " "swap-pane -t '%%'"
#bind-key C-b send-keys 'tat && exit' 'C-m'
bind-key K run-shell 'tmux switch-client -n \; kill-session -t "$(tmux display-message -p "#S")" || tmux kill-session'
############################################################################
## neovim checkhealth suggestions
############################################################################
set-option -sg escape-time 10
# enable focus events to make sure 'autoread' works properly
set-option -g focus-events on
# enable true-colors and RGB capability
set-option -sa terminal-overrides ',xterm-256color:RGB'