Skip to content

Commit 7810165

Browse files
author
Bruno Sutic
committedJul 30, 2014
First commit
0 parents  commit 7810165

File tree

4 files changed

+129
-0
lines changed

4 files changed

+129
-0
lines changed
 

‎CHANGELOG.md

Whitespace-only changes.

‎LICENSE.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Copyright (C) 2014 Bruno Sutic
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the "Software"),
5+
to deal in the Software without restriction, including without limitation
6+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
7+
and/or sell copies of the Software, and to permit persons to whom the
8+
Software is furnished to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice shall be included
11+
in all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
16+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
17+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
19+
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

‎README.md

Whitespace-only changes.

‎sensible.tmux

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#!/usr/bin/env bash
2+
3+
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
is_osx() {
6+
local platform=$(uname)
7+
[ "$platform" == "Darwin" ]
8+
}
9+
10+
option_value_not_changed() {
11+
local option="$1"
12+
local default_value="$2"
13+
local option_value=$(tmux show-option -gv "$option")
14+
[ $option_value == $default_value ]
15+
}
16+
17+
server_option_value_not_changed() {
18+
local option="$1"
19+
local default_value="$2"
20+
local option_value=$(tmux show-option -sv "$option")
21+
[ $option_value == $default_value ]
22+
}
23+
24+
key_binding_not_set() {
25+
local key="$1"
26+
if $(tmux list-keys | grep -q "bind-key[[:space:]]\+${key}"); then
27+
return 1
28+
else
29+
return 0
30+
fi
31+
}
32+
33+
main() {
34+
# OPTIONS
35+
36+
# enable utf8
37+
tmux set-option -g utf8 on
38+
39+
# enable utf8 in tmux status-left and status-right
40+
tmux set-option -g status-utf8 on
41+
42+
# set Ctrl-a as Tmux prefix
43+
if option_value_not_changed "prefix" "C-b"; then
44+
tmux set-option -g prefix C-a
45+
tmux unbind-key C-b
46+
fi
47+
48+
# address vim mode switching delay (http://superuser.com/a/252717/65504)
49+
if server_option_value_not_changed "escape-time" "500"; then
50+
tmux set-option -s escape-time 0
51+
fi
52+
53+
# increase scrollback buffer size
54+
if option_value_not_changed "history-limit" "2000"; then
55+
tmux set-option -g history-limit 50000
56+
fi
57+
58+
# tmux messages are displayed for 4 seconds
59+
if option_value_not_changed "display-time" "750"; then
60+
tmux set-option -g display-time 4000
61+
fi
62+
63+
# refresh 'status-left' and 'status-right' more often
64+
if option_value_not_changed "status-interval" "15"; then
65+
tmux set-option -g status-interval 5
66+
fi
67+
68+
# required (only) on OS X
69+
if is_osx && option_value_not_changed "default-command" ""; then
70+
tmux set-option -g default-command "reattach-to-user-namespace -l bash"
71+
fi
72+
73+
# upgrade $TERM
74+
if option_value_not_changed "default-terminal" "screen"; then
75+
tmux set-option -g default-terminal "screen-256color"
76+
fi
77+
78+
# enable mouse features for terminals that support it
79+
tmux set-option -g mouse-resize-pane on
80+
tmux set-option -g mouse-select-pane on
81+
tmux set-option -g mouse-select-window on
82+
83+
# DEFAULT KEY BINDINGS
84+
85+
# Ctrl-a + a send `Ctrl-a` to the shell
86+
if key_binding_not_set "a"; then
87+
tmux bind-key a send-prefix
88+
fi
89+
90+
# Ctrl-a + Ctrl-a switch between alternate windows
91+
if key_binding_not_set "C-a"; then
92+
tmux bind-key C-a last-window
93+
fi
94+
95+
# easier switching between next/prev window
96+
if key_binding_not_set "C-p"; then
97+
tmux bind-key C-p previous-window
98+
fi
99+
if key_binding_not_set "C-n"; then
100+
tmux bind-key C-n next-window
101+
fi
102+
103+
# source `.tmux.conf` file - as suggested in `man tmux`
104+
if key_binding_not_set "R"; then
105+
tmux bind-key R run-shell -b ' \
106+
tmux source-file ~/.tmux.conf > /dev/null; \
107+
tmux display-message "Sourced .tmux.conf!"'
108+
fi
109+
}
110+
main

0 commit comments

Comments
 (0)
Failed to load comments.