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 " }}}
|
endfunction " }}}
|
||||||
|
|
||||||
function! s:save_vimwiki_buffer() "{{{
|
function! s:save_vimwiki_buffer() "{{{
|
||||||
if &filetype == 'vimwiki'
|
if &filetype == 'vimwiki' && filewritable(expand('%'))
|
||||||
silent update
|
silent update
|
||||||
endif
|
endif
|
||||||
endfunction "}}}
|
endfunction "}}}
|
||||||
|
@ -242,13 +242,15 @@ endfunction "}}}
|
|||||||
|
|
||||||
" COMMANDS {{{
|
" COMMANDS {{{
|
||||||
command! -buffer Vimwiki2HTML
|
command! -buffer Vimwiki2HTML
|
||||||
\ silent noautocmd w <bar>
|
\ if filewritable(expand('%')) | silent noautocmd w | endif
|
||||||
|
\ <bar>
|
||||||
\ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
\ let res = vimwiki#html#Wiki2HTML(expand(VimwikiGet('path_html')),
|
||||||
\ expand('%'))
|
\ expand('%'))
|
||||||
\ <bar>
|
\ <bar>
|
||||||
\ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '.expand(VimwikiGet('path_html')) | endif
|
\ if res != '' | echo 'Vimwiki: HTML conversion is done, output: '.expand(VimwikiGet('path_html')) | endif
|
||||||
command! -buffer Vimwiki2HTMLBrowse
|
command! -buffer Vimwiki2HTMLBrowse
|
||||||
\ silent noautocmd w <bar>
|
\ if filewritable(expand('%')) | silent noautocmd w | endif
|
||||||
|
\ <bar>
|
||||||
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
|
\ call vimwiki#base#system_open_link(vimwiki#html#Wiki2HTML(
|
||||||
\ expand(VimwikiGet('path_html')),
|
\ expand(VimwikiGet('path_html')),
|
||||||
\ expand('%')))
|
\ expand('%')))
|
||||||
|
Loading…
Reference in New Issue
Block a user