Unverified Commit bd671b83 authored by Bruno Sutic's avatar Bruno Sutic
Browse files

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.
parent 327c0481
...@@ -26,6 +26,8 @@ ...@@ -26,6 +26,8 @@
- always use `-ao` flags for `ps` command to detect commands - always use `-ao` flags for `ps` command to detect commands
- Deprecate restoring shell history feature. - Deprecate restoring shell history feature.
- `view` added to the list of automatically restored programs - `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 ### v2.4.0, 2015-02-23
- add "tmux-test" - add "tmux-test"
......
...@@ -13,18 +13,9 @@ vim_session_file_exists() { ...@@ -13,18 +13,9 @@ 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 original 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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment