mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-22 04:18:48 +00:00
parent
8cbc18e130
commit
b8b87a6e29
@ -5,6 +5,7 @@
|
|||||||
sure vim does not contain `-S` flag
|
sure vim does not contain `-S` flag
|
||||||
- enable restoring programs with arguments (e.g. "rails console") and also
|
- enable restoring programs with arguments (e.g. "rails console") and also
|
||||||
processes that contain program name
|
processes that contain program name
|
||||||
|
- improve `irb` restore strategy
|
||||||
|
|
||||||
### v0.1.0, 2014-08-28
|
### v0.1.0, 2014-08-28
|
||||||
- refactor checking if saved tmux session exists
|
- refactor checking if saved tmux session exists
|
||||||
|
@ -1,20 +1,3 @@
|
|||||||
# default processes that are restored
|
|
||||||
default_proc_list_option="@session-saver-default-processes"
|
|
||||||
default_proc_list='vi vim emacs man less more tail top htop irssi irb pry "~rails console"'
|
|
||||||
|
|
||||||
# User defined processes that are restored
|
|
||||||
# 'false' - nothing is restored
|
|
||||||
# ':all:' - all processes are restored
|
|
||||||
#
|
|
||||||
# user defined list of programs that are restored:
|
|
||||||
# 'my_program foo another_program'
|
|
||||||
restore_processes_option="@session-saver-processes"
|
|
||||||
restore_processes=""
|
|
||||||
|
|
||||||
# Defines part of the user variable. Example usage:
|
|
||||||
# set -g @session-saver-strategy-vim "session"
|
|
||||||
restore_process_strategy_option="@session-saver-strategy-"
|
|
||||||
|
|
||||||
restore_pane_processes_enabled() {
|
restore_pane_processes_enabled() {
|
||||||
local restore_processes="$(get_tmux_option "$restore_processes_option" "$restore_processes")"
|
local restore_processes="$(get_tmux_option "$restore_processes_option" "$restore_processes")"
|
||||||
if [ "$restore_processes" == "false" ]; then
|
if [ "$restore_processes" == "false" ]; then
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
source "$CURRENT_DIR/variables.sh"
|
||||||
source "$CURRENT_DIR/helpers.sh"
|
source "$CURRENT_DIR/helpers.sh"
|
||||||
source "$CURRENT_DIR/process_restore_helpers.sh"
|
source "$CURRENT_DIR/process_restore_helpers.sh"
|
||||||
source "$CURRENT_DIR/spinner_helpers.sh"
|
source "$CURRENT_DIR/spinner_helpers.sh"
|
||||||
|
23
scripts/variables.sh
Normal file
23
scripts/variables.sh
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# key bindings
|
||||||
|
default_save_key="M-s"
|
||||||
|
save_option="@session-saver-save"
|
||||||
|
|
||||||
|
default_restore_key="M-r"
|
||||||
|
restore_option="@session-saver-restore"
|
||||||
|
|
||||||
|
# default processes that are restored
|
||||||
|
default_proc_list_option="@session-saver-default-processes"
|
||||||
|
default_proc_list='vi vim emacs man less more tail top htop irssi irb pry "~rails console"'
|
||||||
|
|
||||||
|
# User defined processes that are restored
|
||||||
|
# 'false' - nothing is restored
|
||||||
|
# ':all:' - all processes are restored
|
||||||
|
#
|
||||||
|
# user defined list of programs that are restored:
|
||||||
|
# 'my_program foo another_program'
|
||||||
|
restore_processes_option="@session-saver-processes"
|
||||||
|
restore_processes=""
|
||||||
|
|
||||||
|
# Defines part of the user variable. Example usage:
|
||||||
|
# set -g @session-saver-strategy-vim "session"
|
||||||
|
restore_process_strategy_option="@session-saver-strategy-"
|
@ -2,14 +2,9 @@
|
|||||||
|
|
||||||
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
source "$CURRENT_DIR/scripts/variables.sh"
|
||||||
source "$CURRENT_DIR/scripts/helpers.sh"
|
source "$CURRENT_DIR/scripts/helpers.sh"
|
||||||
|
|
||||||
default_save_key="M-s"
|
|
||||||
save_option="@session-saver-save"
|
|
||||||
|
|
||||||
default_restore_key="M-r"
|
|
||||||
restore_option="@session-saver-restore"
|
|
||||||
|
|
||||||
set_save_bindings() {
|
set_save_bindings() {
|
||||||
local key_bindings=$(get_tmux_option "$save_option" "$default_save_key")
|
local key_bindings=$(get_tmux_option "$save_option" "$default_save_key")
|
||||||
local key
|
local key
|
||||||
@ -26,8 +21,13 @@ set_restore_bindings() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_default_strategies() {
|
||||||
|
tmux set-option -g "${restore_process_strategy_option}irb" "default_strategy"
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
set_save_bindings
|
set_save_bindings
|
||||||
set_restore_bindings
|
set_restore_bindings
|
||||||
|
set_default_strategies
|
||||||
}
|
}
|
||||||
main
|
main
|
||||||
|
23
strategies/irb_default_strategy.sh
Executable file
23
strategies/irb_default_strategy.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# "irb default strategy"
|
||||||
|
#
|
||||||
|
# Example irb process with junk variables:
|
||||||
|
# irb RBENV_VERSION=1.9.3-p429 GREP_COLOR=34;47 TERM_PROGRAM=Apple_Terminal
|
||||||
|
#
|
||||||
|
# When executed, the above will fail. This strategy handles that.
|
||||||
|
|
||||||
|
ORIGINAL_COMMAND="$1"
|
||||||
|
DIRECTORY="$2"
|
||||||
|
|
||||||
|
original_command_wo_junk_vars() {
|
||||||
|
echo "$ORIGINAL_COMMAND" |
|
||||||
|
sed 's/RBENV_VERSION[^ ]*//' |
|
||||||
|
sed 's/GREP_COLOR[^ ]*//' |
|
||||||
|
sed 's/TERM_PROGRAM[^ ]*//'
|
||||||
|
}
|
||||||
|
|
||||||
|
main() {
|
||||||
|
echo "$(original_command_wo_junk_vars)"
|
||||||
|
}
|
||||||
|
main
|
Loading…
Reference in New Issue
Block a user