From 1d5b5e553cdee66fb8d6e77f111f835a4d4cc3d4 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Mon, 14 Feb 2022 17:35:21 +0100 Subject: [PATCH] asciidoctor: Add F5 keymap logic --- keymaps.vim | 2 +- macros.vim | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) 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." -- 2.39.5