Unverified Commit 297e5b69 authored by Bruno Sutic's avatar Bruno Sutic
Browse files

Improve initial plugin save delay

parent ab3e951c
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
- do not auto-restore tmux environment if another tmux server is already running - do not auto-restore tmux environment if another tmux server is already running
(we don't want to duplicate stuff) (we don't want to duplicate stuff)
- bugfixes for 'tmux auto start' OS X Terminal.app and iTerm scripts - bugfixes for 'tmux auto start' OS X Terminal.app and iTerm scripts
- prevent saving for the first 15 minutes only when plugin is sourced the first
time (not on subsequent sources or tmux.conf reloads)
### v2.1.0, 2015-02-18 ### v2.1.0, 2015-02-18
- enable "tmux auto start" for OS X - enable "tmux auto start" for OS X
......
...@@ -16,6 +16,13 @@ handle_tmux_automatic_start() { ...@@ -16,6 +16,13 @@ handle_tmux_automatic_start() {
$CURRENT_DIR/scripts/handle_tmux_automatic_start.sh $CURRENT_DIR/scripts/handle_tmux_automatic_start.sh
} }
delay_saving_environment_on_first_plugin_load() {
if [ -z "$(get_tmux_option "$last_auto_save_option" "")" ]; then
# last save option not set, this is first time plugin load
set_last_save_timestamp
fi
}
add_resurrect_save_interpolation() { add_resurrect_save_interpolation() {
local status_right_value="$(get_tmux_option "status-right" "")" local status_right_value="$(get_tmux_option "status-right" "")"
local new_value="${save_command_interpolation}${status_right_value}" local new_value="${save_command_interpolation}${status_right_value}"
...@@ -37,9 +44,8 @@ main() { ...@@ -37,9 +44,8 @@ main() {
if supported_tmux_version_ok; then if supported_tmux_version_ok; then
handle_tmux_automatic_start handle_tmux_automatic_start
# Don't start saving right after tmux is started. # give user a chance to restore previously saved session
# We wanna give user a chance to restore previous session. delay_saving_environment_on_first_plugin_load
set_last_save_timestamp
add_resurrect_save_interpolation add_resurrect_save_interpolation
if just_started_tmux_server; then if just_started_tmux_server; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment