Я собрал следующую кучу удивительности:
if !exists("g:AsciidocAutoSave")
let g:AsciidocAutoSave = 0
endif
fun! AsciidocRefresh()
if g:AsciidocAutoSave == 1
execute 'write'
execute 'silent !asciidoc -b html5 -a icons "%"'
endif
endf
fun! AsciidocFocusLost()
augroup asciidocFocusLost
autocmd FocusLost <buffer> call AsciidocRefresh()
augroup END
endfun
augroup asciidocFileType
autocmd FileType asciidoc :call AsciidocFocusLost()
augroup END
Единственная проблема: он сохраняется дважды каждый раз, когда vim теряет фокус в файле asciidoc
.
Когда я ввожу :autocmd asciidocFileType
в командную строку, она показывает:
---Auto-Commands---
asciidocFileType FileType
asciidoc :call AsciidocFocusLost()
:call AsciidocFocusLost()
То же самое с :autocmd asciidocFocusLost
и AsciidocRefresh()
.
Зачем это дублирование?