Vim gets stuck when converting a read-only file

because it tries to write it beforehand.
Fix #81
This commit is contained in:
EinfachToll 2014-10-23 12:18:28 +02:00
parent fb5ea2886b
commit 39b6239820
2 changed files with 6 additions and 4 deletions

View File

@ -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 "}}}

View File

@ -242,13 +242,15 @@ endfunction "}}}
" COMMANDS {{{
command! -buffer Vimwiki2HTML
\ silent noautocmd w <bar>
\ if filewritable(expand('%')) | silent noautocmd w | endif
\ <bar>
\ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
\ expand('%'))
\<bar>
\ <bar>
\ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '.expand(VimwikiGet('path_html')) | endif
command! -buffer Vimwiki2HTMLBrowse
\ silent noautocmd w <bar>
\ if filewritable(expand('%')) | silent noautocmd w | endif
\ <bar>
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
\ expand(VimwikiGet('path_html')),
\ expand('%')))