mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-25 22:48:46 +00:00
24 lines
405 B
Bash
24 lines
405 B
Bash
|
#!/usr/bin/env bash
|
||
|
|
||
|
# "vim session strategy"
|
||
|
#
|
||
|
# Restores a vim session from 'Session.vim' file, if it exists.
|
||
|
# If 'Session.vim' does not exist, it falls back to invoking the original
|
||
|
# command.
|
||
|
|
||
|
ORIGINAL_COMMAND="$1"
|
||
|
DIRECTORY="$2"
|
||
|
|
||
|
vim_session_file_exists() {
|
||
|
[ -e "${DIRECTORY}/Session.vim" ]
|
||
|
}
|
||
|
|
||
|
main() {
|
||
|
if vim_session_file_exists; then
|
||
|
echo "vim -S"
|
||
|
else
|
||
|
echo "$ORIGINAL_COMMAND"
|
||
|
fi
|
||
|
}
|
||
|
main
|