Fix problem with open swap-file

This commit is contained in:
Michael F. Schönitzer 2018-07-27 02:46:12 +02:00
parent 44a1f3a6f3
commit 2185815b00

View File

@ -720,19 +720,19 @@ function! vimwiki#base#edit_file(command, filename, anchor, ...)
" This hack is necessary because apparently Vim messes up the result of
" getpos() directly after this command. Strange.
if !(a:command ==# ':e ' && vimwiki#path#is_equal(a:filename, expand('%:p')))
try
if &autowriteall && !&hidden " in this case, the file is saved before switching to the
" new buffer. This causes Vim to show two messages in the command line which triggers
" the annoying hit-enter prompt. Solution: show no messages at all.
silent execute a:command fname
else
try
execute a:command fname
endif
catch /E37:/
echomsg 'Vimwiki: The current file is modified. Hint: Take a look at'
\ ''':h g:vimwiki_autowriteall'' to see how to save automatically.'
return
endtry
endif
" If the opened file was not already loaded by Vim, an autocommand is
" triggered at this point