8 Commits

Author SHA1 Message Date
fff9a53723 v2.3.0 2015-06-24 16:12:36 +02:00
2476f3fb23 Fix option for tmux 2.0+ 2015-06-24 15:02:14 +02:00
3ea5b9f6b9 Support *the* latest tmux version 2015-05-08 22:33:06 +02:00
9d61936c53 Bugfix for 'prefix + R' key binding 2015-02-12 16:42:33 +01:00
e725d88256 v2.2.0 2015-02-10 02:13:56 +01:00
ba0b52d999 Enable 2015-02-10 02:13:14 +01:00
b5a1c2ade5 Fix regex in key_binding_not_set
Fixes #15
2014-12-23 23:04:28 +01:00
22d1305cb7 Add a link to tmux-resurrect to the readme 2014-12-12 23:42:14 +01:00
3 changed files with 29 additions and 4 deletions

View File

@ -2,6 +2,16 @@
### master
### v2.3.0, 2015-06-24
- update to support \*THE\* latest tmux version
- bugfix for `prefix + R` key binding
- fix for tmux 2.0 `default-terminal` option (thanks @kwbr)
### v2.2.0, 2015-02-10
- bugfix in `key_binding_not_set`: the regex is now properly detecting key
bindings with `-r` flag.
- enable `aggressive-resize`
### v2.1.0, 2014-12-12
- check before binding `prefix + prefix` (@m1foley)
- enable `focus-events`

View File

@ -51,6 +51,9 @@ Inspired by [vim-sensible](https://github.com/tpope/vim-sensible).
# focus events enabled for terminals that support them
set -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
setw -g aggressive-resize on
### Key bindings
# easier and faster switching between next/prev window
@ -130,6 +133,8 @@ You might also find these useful:
improve tmux search and reduce mouse usage
- [pain control](https://github.com/tmux-plugins/tmux-pain-control)
useful standard bindings for controlling panes
- [resurrect](https://github.com/tmux-plugins/tmux-resurrect)
persists tmux environment across system restarts
### License

View File

@ -4,6 +4,9 @@ CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ALMOST_SENSIBLE_OPTION="@almost-sensible"
# used to match output from `tmux list-keys`
KEY_BINDING_REGEX="bind-key[[:space:]]\+\(-r[[:space:]]\+\)\?\(-T prefix[[:space:]]\+\)\?"
is_osx() {
local platform=$(uname)
[ "$platform" == "Darwin" ]
@ -41,7 +44,7 @@ server_option_value_not_changed() {
key_binding_not_set() {
local key="$1"
if $(tmux list-keys | grep -q "bind-key[[:space:]]\+${key}"); then
if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]"); then
return 1
else
return 0
@ -51,7 +54,7 @@ key_binding_not_set() {
key_binding_not_changed() {
local key="$1"
local default_value="$2"
if $(tmux list-keys | grep -q "bind-key[[:space:]]\+${key}[[:space:]]\+${default_value}"); then
if $(tmux list-keys | grep -q "${KEY_BINDING_REGEX}${key}[[:space:]]\+${default_value}"); then
# key still has the default binding
return 0
else
@ -98,10 +101,14 @@ main() {
tmux set-option -g default-command "reattach-to-user-namespace -l $SHELL"
fi
# upgrade $TERM
# upgrade $TERM, tmux 1.9
if option_value_not_changed "default-terminal" "screen"; then
tmux set-option -g default-terminal "screen-256color"
fi
# upgrade $TERM, tmux 2.0+
if server_option_value_not_changed "default-terminal" "screen"; then
tmux set-option -s default-terminal "screen-256color"
fi
# emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users
@ -110,6 +117,9 @@ main() {
# focus events enabled for terminals that support them
tmux set-option -g focus-events on
# super useful when using "grouped sessions" and multi-monitor setup
tmux set-window-option -g aggressive-resize on
# ALMOST SENSIBLE OPTIONS - DEPRECATED
if almost_sensible_on; then
@ -157,7 +167,7 @@ main() {
# source `.tmux.conf` file - as suggested in `man tmux`
if key_binding_not_set "R"; then
tmux bind-key R run-shell -b ' \
tmux bind-key R run-shell ' \
tmux source-file ~/.tmux.conf > /dev/null; \
tmux display-message "Sourced .tmux.conf!"'
fi