mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-11-22 12:38:47 +00:00
Fix #18: improve vim 'session' strategy
This commit is contained in:
parent
ee1ab0c728
commit
8cb5b21e2f
@ -1,6 +1,8 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
### master
|
### master
|
||||||
|
- bugfix: with vim 'session' strategy, if the session file does not exist - make
|
||||||
|
sure wim does not contain `-S` flag
|
||||||
|
|
||||||
### 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
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#
|
#
|
||||||
# Restores a vim session from 'Session.vim' file, if it exists.
|
# Restores a vim session from 'Session.vim' file, if it exists.
|
||||||
# If 'Session.vim' does not exist, it falls back to invoking the original
|
# If 'Session.vim' does not exist, it falls back to invoking the original
|
||||||
# command.
|
# command (withouth the `-S` flag).
|
||||||
|
|
||||||
ORIGINAL_COMMAND="$1"
|
ORIGINAL_COMMAND="$1"
|
||||||
DIRECTORY="$2"
|
DIRECTORY="$2"
|
||||||
@ -13,9 +13,18 @@ vim_session_file_exists() {
|
|||||||
[ -e "${DIRECTORY}/Session.vim" ]
|
[ -e "${DIRECTORY}/Session.vim" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
original_command_contains_session_flag() {
|
||||||
|
[[ "$ORIGINAL_COMMAND" =~ "-S" ]]
|
||||||
|
}
|
||||||
|
|
||||||
main() {
|
main() {
|
||||||
if vim_session_file_exists; then
|
if vim_session_file_exists; then
|
||||||
echo "vim -S"
|
echo "vim -S"
|
||||||
|
elif original_command_contains_session_flag; then
|
||||||
|
# Session file does not exist, yet the orignal vim command contains
|
||||||
|
# session flag `-S`. This will cause an error, so we're falling back to
|
||||||
|
# starting plain vim.
|
||||||
|
echo "vim"
|
||||||
else
|
else
|
||||||
echo "$ORIGINAL_COMMAND"
|
echo "$ORIGINAL_COMMAND"
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user