Merge 0938a75c05
into cff343cf9e
commit
9e07fe6cdc
|
@ -26,7 +26,8 @@ Automatic restoring and continuous saving of tmux env is also possible with
|
||||||
|
|
||||||
### Key bindings
|
### Key bindings
|
||||||
|
|
||||||
- `prefix + Ctrl-s` - save
|
- `prefix + Ctrl-s` - save all sessions
|
||||||
|
- `prefix + Ctrl-t` - save current session
|
||||||
- `prefix + Ctrl-r` - restore
|
- `prefix + Ctrl-r` - restore
|
||||||
|
|
||||||
### About
|
### About
|
||||||
|
|
|
@ -2,10 +2,12 @@
|
||||||
|
|
||||||
The default key bindings are:
|
The default key bindings are:
|
||||||
|
|
||||||
- `prefix + Ctrl-s` - save
|
- `prefix + Ctrl-s` - save all sessions
|
||||||
|
- `prefix + Ctrl-t` - save current session
|
||||||
- `prefix + Ctrl-r` - restore
|
- `prefix + Ctrl-r` - restore
|
||||||
|
|
||||||
To change these, add to `.tmux.conf`:
|
To change these, add to `.tmux.conf`:
|
||||||
|
|
||||||
set -g @resurrect-save 'S'
|
set -g @resurrect-save 'S'
|
||||||
|
set -g @resurrect-save-current 'T'
|
||||||
set -g @resurrect-restore 'R'
|
set -g @resurrect-restore 'R'
|
||||||
|
|
|
@ -13,6 +13,14 @@ set_save_bindings() {
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
set_save_current_bindings() {
|
||||||
|
local key_bindings=$(get_tmux_option "$save_current_option" "$default_save_current_key")
|
||||||
|
local key
|
||||||
|
for key in $key_bindings; do
|
||||||
|
tmux bind-key "$key" run-shell "$CURRENT_DIR/scripts/save.sh -t #S"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
set_restore_bindings() {
|
set_restore_bindings() {
|
||||||
local key_bindings=$(get_tmux_option "$restore_option" "$default_restore_key")
|
local key_bindings=$(get_tmux_option "$restore_option" "$default_restore_key")
|
||||||
local key
|
local key
|
||||||
|
@ -33,6 +41,7 @@ set_script_path_options() {
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
set_save_bindings
|
set_save_bindings
|
||||||
|
set_save_current_bindings
|
||||||
set_restore_bindings
|
set_restore_bindings
|
||||||
set_default_strategies
|
set_default_strategies
|
||||||
set_script_path_options
|
set_script_path_options
|
||||||
|
|
|
@ -10,8 +10,18 @@ source "$CURRENT_DIR/spinner_helpers.sh"
|
||||||
d=$'\t'
|
d=$'\t'
|
||||||
delimiter=$'\t'
|
delimiter=$'\t'
|
||||||
|
|
||||||
# if "quiet" script produces no output
|
while getopts "t:q" opt; do
|
||||||
SCRIPT_OUTPUT="$1"
|
case "$opt" in
|
||||||
|
t)
|
||||||
|
TARGET_SESSION="$OPTARG"
|
||||||
|
tmux has-session -t "$TARGET_SESSION" ||
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
q)
|
||||||
|
SCRIPT_OUTPUT="quiet"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
grouped_sessions_format() {
|
grouped_sessions_format() {
|
||||||
local format
|
local format
|
||||||
|
@ -82,11 +92,15 @@ state_format() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_panes_raw() {
|
dump_panes_raw() {
|
||||||
tmux list-panes -a -F "$(pane_format)"
|
[ -z "$TARGET_SESSION" ] &&
|
||||||
|
tmux list-panes -a -F "$(pane_format)" ||
|
||||||
|
tmux list-panes -s -t "$TARGET_SESSION" -F "$(pane_format)"
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_windows_raw(){
|
dump_windows_raw(){
|
||||||
tmux list-windows -a -F "$(window_format)"
|
[ -z "$TARGET_SESSION" ] &&
|
||||||
|
tmux list-windows -a -F "$(window_format)" ||
|
||||||
|
tmux list-windows -t "$TARGET_SESSION" -F "$(window_format)"
|
||||||
}
|
}
|
||||||
|
|
||||||
toggle_window_zoom() {
|
toggle_window_zoom() {
|
||||||
|
@ -215,6 +229,7 @@ dump_windows() {
|
||||||
}
|
}
|
||||||
|
|
||||||
dump_state() {
|
dump_state() {
|
||||||
|
[[ -z "$TARGET_SESSION" ]] || return
|
||||||
tmux display-message -p "$(state_format)"
|
tmux display-message -p "$(state_format)"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,9 @@ default_save_key="C-s"
|
||||||
save_option="@resurrect-save"
|
save_option="@resurrect-save"
|
||||||
save_path_option="@resurrect-save-script-path"
|
save_path_option="@resurrect-save-script-path"
|
||||||
|
|
||||||
|
default_save_current_key="C-t"
|
||||||
|
save_current_option="@resurrect-save-current"
|
||||||
|
|
||||||
default_restore_key="C-r"
|
default_restore_key="C-r"
|
||||||
restore_option="@resurrect-restore"
|
restore_option="@resurrect-restore"
|
||||||
restore_path_option="@resurrect-restore-script-path"
|
restore_path_option="@resurrect-restore-script-path"
|
||||||
|
|
Loading…
Reference in New Issue