Skip to content

Fix issue with dangling swap files #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 6, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions plugin/multimonitor.vim
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,19 @@ function! Swap_Exists()
endif
endfor

" If finding the server fails, abort this process.
" The swap file may legitimately need to be recovered, but this lets
" the user get control of what happens with the swap file.
" This shouldn't happen unless a bug preserves a swap file, or Vim is
" forcibly closed as a result of an OS-level halt. For an instance, if the
" computer randomly decides to update while there's unsaved files, if
" there's a power outage or the computer otherwise loses power, or if
" there's an accident that causes Vim to be force closed in a way that
" doesn't properly handle buffers and clear swap files.
if owning_server == ""
return
endif

let swapcommand = substitute(v:swapcommand, "\r", "", "g")
let remexpr = "Remote_Open('" . expand("<afile>") . "', '" . swapcommand . "')"

Expand Down