diff --git a/autoload/vimwiki/html.vim b/autoload/vimwiki/html.vim
index 020285b..47c755a 100644
--- a/autoload/vimwiki/html.vim
+++ b/autoload/vimwiki/html.vim
@@ -204,7 +204,7 @@ function! s:subst_func(line, regexp, func, ...) " {{{
endfunction " }}}
function! s:save_vimwiki_buffer() "{{{
- if &filetype == 'vimwiki'
+ if &filetype == 'vimwiki' && filewritable(expand('%'))
silent update
endif
endfunction "}}}
diff --git a/ftplugin/vimwiki.vim b/ftplugin/vimwiki.vim
index 9781a67..936ea17 100644
--- a/ftplugin/vimwiki.vim
+++ b/ftplugin/vimwiki.vim
@@ -242,13 +242,15 @@ endfunction "}}}
" COMMANDS {{{
command! -buffer Vimwiki2HTML
- \ silent noautocmd w
+ \ if filewritable(expand('%')) | silent noautocmd w | endif
+ \
\ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
\ expand('%'))
- \
+ \
\ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '.expand(VimwikiGet('path_html')) | endif
command! -buffer Vimwiki2HTMLBrowse
- \ silent noautocmd w
+ \ if filewritable(expand('%')) | silent noautocmd w | endif
+ \
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
\ expand(VimwikiGet('path_html')),
\ expand('%')))