Vim gets stuck when converting a read-only file
because it tries to write it beforehand. Fix #81
This commit is contained in:
parent
fb5ea2886b
commit
39b6239820
@ -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 "}}}
|
||||
|
@ -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>
|
||||
\ 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('%')))
|
||||
|
Loading…
Reference in New Issue
Block a user