Skip to content

Commit bd671b8

Browse files
committed
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.
1 parent 327c048 commit bd671b8

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
- always use `-ao` flags for `ps` command to detect commands
2727
- Deprecate restoring shell history feature.
2828
- `view` added to the list of automatically restored programs
29+
- Enable vim session strategy to work with custom session files,
30+
e.g. `vim -S Session1.vim`.
2931

3032
### v2.4.0, 2015-02-23
3133
- add "tmux-test"

strategies/vim_session.sh

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,9 @@ vim_session_file_exists() {
1313
[ -e "${DIRECTORY}/Session.vim" ]
1414
}
1515

16-
original_command_contains_session_flag() {
17-
[[ "$ORIGINAL_COMMAND" =~ "-S" ]]
18-
}
19-
2016
main() {
2117
if vim_session_file_exists; then
2218
echo "vim -S"
23-
elif original_command_contains_session_flag; then
24-
# Session file does not exist, yet the original vim command contains
25-
# session flag `-S`. This will cause an error, so we're falling back to
26-
# starting plain vim.
27-
echo "vim"
2819
else
2920
echo "$ORIGINAL_COMMAND"
3021
fi

0 commit comments

Comments
 (0)