asciidoctor: Add F5 keymap logic
authorStefan Huber <shuber@sthu.org>
Mon, 14 Feb 2022 16:35:21 +0000 (17:35 +0100)
committerStefan Huber <shuber@sthu.org>
Mon, 14 Feb 2022 16:35:21 +0000 (17:35 +0100)
keymaps.vim
macros.vim

index bf0597d1661f1c9ea0dc8d5fea16b0ca5f11915a..38f7774ee4d6a38379edc9f0e8f66e243c19337b 100644 (file)
@@ -69,7 +69,7 @@ au Filetype c,cpp,objc map <buffer> <S-F12> :FSHere<CR>
 au Filetype c,cpp,objc map <buffer> <F24> :FSHere<CR>
 
 au Filetype markdown map <buffer> <F5> :call RunMarkdown()<CR>
 au Filetype c,cpp,objc map <buffer> <F24> :FSHere<CR>
 
 au Filetype markdown map <buffer> <F5> :call RunMarkdown()<CR>
-au Filetype asciidoc map <buffer> <F5> :call RunAsciidoc()<CR>
+au Filetype asciidoc,asciidoctor map <buffer> <F5> :call RunAsciidoc()<CR>
 
 " See https://github.com/artur-shaik/vim-Javacomplete2
 " <C-j>ji <leader>ji
 
 " See https://github.com/artur-shaik/vim-Javacomplete2
 " <C-j>ji <leader>ji
index d74406055ece5b04f6c1184bcbfe2f7c9340adfd..1da3dae9c56080df7f1cdc01545f006bef4759ac 100644 (file)
@@ -112,6 +112,15 @@ endfunction
 
 function RunAsciidoctor()
   execute ":!asciidoctor " . @%
 
 function RunAsciidoctor()
   execute ":!asciidoctor " . @%
+  if executable("asciidoctor-pdf")
+    execute ":!asciidoctor-pdf " . @%
+  elseif executable("asciidoctor")
+    execute ":!asciidoctor " . @%
+  endif
+endfunction
+
+function RunAsciidoctorPdf()
+  execute ":!asciidoctor-pdf " . @%
 endfunction
 
 
 endfunction
 
 
@@ -129,7 +138,9 @@ endfunction
 
 
 function RunAsciidoc()
 
 
 function RunAsciidoc()
-  if executable("asciidoctor")
+  if executable("asciidoctor-pdf")
+    call RunAsciidoctorPdf()
+  elseif executable("asciidoctor")
     call RunAsciidoctor()
   else
     echo "No asciidoc implementation found."
     call RunAsciidoctor()
   else
     echo "No asciidoc implementation found."