From: Stefan Huber Date: Mon, 14 Feb 2022 16:35:21 +0000 (+0100) Subject: asciidoctor: Add F5 keymap logic X-Git-Url: https://git.sthu.org/?a=commitdiff_plain;h=1d5b5e553cdee66fb8d6e77f111f835a4d4cc3d4;p=vimconf.git asciidoctor: Add F5 keymap logic --- diff --git a/keymaps.vim b/keymaps.vim index bf0597d..38f7774 100644 --- a/keymaps.vim +++ b/keymaps.vim @@ -69,7 +69,7 @@ au Filetype c,cpp,objc map :FSHere au Filetype c,cpp,objc map :FSHere au Filetype markdown map :call RunMarkdown() -au Filetype asciidoc map :call RunAsciidoc() +au Filetype asciidoc,asciidoctor map :call RunAsciidoc() " See https://github.com/artur-shaik/vim-Javacomplete2 " ji ji diff --git a/macros.vim b/macros.vim index d744060..1da3dae 100644 --- a/macros.vim +++ b/macros.vim @@ -112,6 +112,15 @@ endfunction function RunAsciidoctor() execute ":!asciidoctor " . @% + if executable("asciidoctor-pdf") + execute ":!asciidoctor-pdf " . @% + elseif executable("asciidoctor") + execute ":!asciidoctor " . @% + endif +endfunction + +function RunAsciidoctorPdf() + execute ":!asciidoctor-pdf " . @% endfunction @@ -129,7 +138,9 @@ endfunction function RunAsciidoc() - if executable("asciidoctor") + if executable("asciidoctor-pdf") + call RunAsciidoctorPdf() + elseif executable("asciidoctor") call RunAsciidoctor() else echo "No asciidoc implementation found."