From 2185815b0004018cc4c5261f7be1d6936c9fcd22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20F=2E=20Sch=C3=B6nitzer?= Date: Fri, 27 Jul 2018 02:46:12 +0200 Subject: [PATCH] Fix problem with open swap-file --- autoload/vimwiki/base.vim | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/autoload/vimwiki/base.vim b/autoload/vimwiki/base.vim index 3a6e128..0f399ea 100644 --- a/autoload/vimwiki/base.vim +++ b/autoload/vimwiki/base.vim @@ -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 + 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 + 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