mirror of
https://github.com/tmux-plugins/tmux-resurrect.git
synced 2024-10-31 22:38:58 +00:00
Don't be too smart when restoring vim session
A user may decide to use custom session file. Eg vim -S Session1.vim With the previous approach we were preventing that as we only checked for the existence of the default Session.vim file.
This commit is contained in:
parent
327c0481ad
commit
bd671b83dc
@ -26,6 +26,8 @@
|
||||
- always use `-ao` flags for `ps` command to detect commands
|
||||
- Deprecate restoring shell history feature.
|
||||
- `view` added to the list of automatically restored programs
|
||||
- Enable vim session strategy to work with custom session files,
|
||||
e.g. `vim -S Session1.vim`.
|
||||
|
||||
### v2.4.0, 2015-02-23
|
||||
- add "tmux-test"
|
||||
|
@ -13,18 +13,9 @@ vim_session_file_exists() {
|
||||
[ -e "${DIRECTORY}/Session.vim" ]
|
||||
}
|
||||
|
||||
original_command_contains_session_flag() {
|
||||
[[ "$ORIGINAL_COMMAND" =~ "-S" ]]
|
||||
}
|
||||
|
||||
main() {
|
||||
if vim_session_file_exists; then
|
||||
echo "vim -S"
|
||||
elif original_command_contains_session_flag; then
|
||||
# Session file does not exist, yet the original vim command contains
|
||||
# session flag `-S`. This will cause an error, so we're falling back to
|
||||
# starting plain vim.
|
||||
echo "vim"
|
||||
else
|
||||
echo "$ORIGINAL_COMMAND"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user